- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 33 for cutPrefix (0.17 sec)
-
src/cmd/go/internal/test/internal/genflags/testflag.go
// users may pass to 'go test'. func ShortTestFlags() []string { testing.Init() var names []string flag.VisitAll(func(f *flag.Flag) { var name string var found bool if name, found = strings.CutPrefix(f.Name, "test."); !found { return } switch name { case "testlogfile", "paniconexit0", "fuzzcachedir", "fuzzworker", "gocoverdir": // These flags are only for use by cmd/go. default:
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu Feb 09 13:37:58 UTC 2023 - 759 bytes - Viewed (0) -
src/math/rand/v2/chacha8.go
func (c *ChaCha8) UnmarshalBinary(data []byte) error { data, ok := cutPrefix(data, []byte("readbuf:")) if ok { var buf []byte buf, data, ok = readUint8LengthPrefixed(data) if !ok { return errors.New("invalid ChaCha8 Read buffer encoding") } c.readLen = copy(c.readBuf[len(c.readBuf)-len(buf):], buf) } return chacha8rand.Unmarshal(&c.state, data) } func cutPrefix(s, prefix []byte) (after []byte, found bool) {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed May 22 22:09:08 UTC 2024 - 2.8K bytes - Viewed (0) -
src/strings/example_test.go
} func ExampleCutPrefix() { show := func(s, sep string) { after, found := strings.CutPrefix(s, sep) fmt.Printf("CutPrefix(%q, %q) = %q, %v\n", s, sep, after, found) } show("Gopher", "Go") show("Gopher", "ph") // Output: // CutPrefix("Gopher", "Go") = "pher", true // CutPrefix("Gopher", "ph") = "Gopher", false } func ExampleCutSuffix() { show := func(s, sep string) {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon Oct 09 22:05:38 UTC 2023 - 10.7K bytes - Viewed (0) -
src/runtime/coro_test.go
t.Helper() c := strings.SplitN(output, "\n", 2) if len(c) == 1 { t.Fatalf("expected at least one complete line in the output, got:\n%s", output) } expect, ok := strings.CutPrefix(c[0], "expect: ") if !ok { t.Fatalf("expected first line of output to start with \"expect: \", got: %q", c[0]) } rest := c[1] if expect == "OK" && rest != "OK\n" {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Fri May 17 21:36:37 UTC 2024 - 1.9K bytes - Viewed (0) -
src/go/build/vendor_test.go
listCmd := testenv.Command(t, goBin, "list", "std", "cmd") out, err := listCmd.Output() if err != nil { t.Fatal(err) } for _, fullPkg := range strings.Split(string(out), "\n") { pkg, found := strings.CutPrefix(fullPkg, "vendor/") if !found { _, pkg, found = strings.Cut(fullPkg, "/vendor/") if !found { continue } } if !isAllowed(pkg) { t.Errorf(`
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed Feb 28 16:29:14 UTC 2024 - 1.9K bytes - Viewed (0) -
src/internal/stringslite/strings.go
} } return -1 } func Cut(s, sep string) (before, after string, found bool) { if i := Index(s, sep); i >= 0 { return s[:i], s[i+len(sep):], true } return s, "", false } func CutPrefix(s, prefix string) (after string, found bool) { if !HasPrefix(s, prefix) { return s, false } return s[len(prefix):], true } func CutSuffix(s, suffix string) (before string, found bool) {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Sat May 04 01:23:42 UTC 2024 - 2.9K bytes - Viewed (0) -
src/runtime/testdata/testprog/traceback_ancestors.go
} recurseThenCallGo(w, frames, goroutines-1, main) } func goroutineID() string { buf := make([]byte, 128) runtime.Stack(buf, false) prefix := []byte("goroutine ") var found bool if buf, found = bytes.CutPrefix(buf, prefix); !found { panic(fmt.Sprintf("expected %q at beginning of traceback:\n%s", prefix, buf)) } id, _, _ := bytes.Cut(buf, []byte(" ")) return string(id)
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue Sep 27 17:14:59 UTC 2022 - 2.1K bytes - Viewed (0) -
src/go/printer/comment.go
return list } text = text[2 : len(text)-2] // cut /* and */ } else if strings.HasPrefix(list[0].Text, "//") { kind = "//" var b strings.Builder for _, c := range list { after, found := strings.CutPrefix(c.Text, "//") if !found { return list } // Accumulate //go:build etc lines separately. if isDirective(after) { directives = append(directives, c) continue }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue Sep 27 07:35:19 UTC 2022 - 3.5K bytes - Viewed (0) -
src/cmd/go/internal/modload/vendor.go
} if annotations, ok := strings.CutPrefix(line, "## "); ok { // Metadata. Take the union of annotations across multiple lines, if present. meta := vendorMeta[mod] for _, entry := range strings.Split(annotations, ";") { entry = strings.TrimSpace(entry) if entry == "explicit" { meta.Explicit = true } if goVersion, ok := strings.CutPrefix(entry, "go "); ok { meta.GoVersion = goVersion
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon Jul 24 18:09:22 UTC 2023 - 9.5K bytes - Viewed (0) -
src/go/types/check_test.go
// At least one of the errors in errList should match the current error. indices = indices[:0] for i, want := range errList { pattern, substr := strings.CutPrefix(want.text, " ERROR ") if !substr { var found bool pattern, found = strings.CutPrefix(want.text, " ERRORx ") if !found { panic("unreachable") } } unquoted, err := strconv.Unquote(strings.TrimSpace(pattern)) if err != nil {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed May 22 19:45:33 UTC 2024 - 14.1K bytes - Viewed (0)