- Sort Score
- Result 10 results
- Languages All
Results 1 - 8 of 8 for Turing (0.48 sec)
-
src/flag/example_test.go
type interval []time.Duration // String is the method to format the flag's value, part of the flag.Value interface. // The String method's output will be used in diagnostics. func (i *interval) String() string { return fmt.Sprint(*i) } // Set is the method to set the flag value, part of the flag.Value interface. // Set's argument is a string to be parsed to set the flag.
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed Oct 26 18:59:00 UTC 2022 - 2.8K bytes - Viewed (0) -
src/encoding/base64/example_test.go
encoded := base64.StdEncoding.EncodeToString([]byte(msg)) fmt.Println(encoded) decoded, err := base64.StdEncoding.DecodeString(encoded) if err != nil { fmt.Println("decode error:", err) return } fmt.Println(string(decoded)) // Output: // SGVsbG8sIOS4lueVjA== // Hello, 世界 } func ExampleEncoding_EncodeToString() { data := []byte("any + old & data") str := base64.StdEncoding.EncodeToString(data) fmt.Println(str)
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue Oct 19 08:44:22 UTC 2021 - 1.9K bytes - Viewed (0) -
src/context/example_test.go
// Output: // context deadline exceeded } // This example demonstrates how a value can be passed to the context // and also how to retrieve it if it exists. func ExampleWithValue() { type favContextKey string f := func(ctx context.Context, k favContextKey) { if v := ctx.Value(k); v != nil { fmt.Println("found value:", v) return } fmt.Println("key not found:", k) }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon Aug 21 20:24:28 UTC 2023 - 6.7K bytes - Viewed (0) -
src/go/constant/example_test.go
vs := []constant.Value{ constant.MakeString("Z"), constant.MakeString("bacon"), constant.MakeString("go"), constant.MakeString("Frame"), constant.MakeString("defer"), constant.MakeFromLiteral(`"a"`, token.STRING, 0), } slices.SortFunc(vs, func(a, b constant.Value) int { if constant.Compare(a, token.LSS, b) { return -1 } if constant.Compare(a, token.GTR, b) { return +1 } return 0
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu May 23 01:00:11 UTC 2024 - 3.5K bytes - Viewed (0) -
src/encoding/json/example_test.go
} fmt.Printf("\n") } // Output: // json.Delim: { (more) // string: Message (more) // string: Hello (more) // string: Array (more) // json.Delim: [ (more) // float64: 1 (more) // float64: 2 (more) // float64: 3 // json.Delim: ] (more) // string: Null (more) // <nil>: <nil> (more) // string: Number (more) // float64: 1.234 // json.Delim: } }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon Dec 13 18:45:54 UTC 2021 - 6.1K bytes - Viewed (0) -
src/go/ast/example_test.go
f, err := parser.ParseFile(fset, "src.go", src, 0) if err != nil { panic(err) } // Inspect the AST and print all identifiers and literals. ast.Inspect(f, func(n ast.Node) bool { var s string switch x := n.(type) { case *ast.BasicLit: s = x.Value case *ast.Ident: s = x.Name } if s != "" { fmt.Printf("%s:\t%s\n", fset.Position(n.Pos()), s) } return true })
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed May 15 21:44:50 UTC 2024 - 6.1K bytes - Viewed (0) -
src/errors/example_test.go
import ( "errors" "fmt" "io/fs" "os" "time" ) // MyError is an error implementation that includes a time and message. type MyError struct { When time.Time What string } func (e MyError) Error() string { return fmt.Sprintf("%v: %v", e.When, e.What) } func oops() error { return MyError{ time.Date(1989, 3, 15, 22, 30, 0, 0, time.UTC), "the file system has gone away", } }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed Aug 16 02:08:40 UTC 2023 - 2.2K bytes - Viewed (0) -
src/compress/gzip/example_test.go
// // A long time ago in a galaxy far, far away... } func ExampleReader_Multistream() { var buf bytes.Buffer zw := gzip.NewWriter(&buf) var files = []struct { name string comment string modTime time.Time data string }{ {"file-1.txt", "file-header-1", time.Date(2006, time.February, 1, 3, 4, 5, 0, time.UTC), "Hello Gophers - 1"},
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed Jun 22 16:24:14 UTC 2022 - 4.8K bytes - Viewed (0)