diff options
author | Jes Cok <xigua67damn@gmail.com> | 2024-05-04 20:13:15 +0800 |
---|---|---|
committer | Gopher Robot <gobot@golang.org> | 2024-05-06 14:00:54 +0000 |
commit | eabf59bc47484e3f09fe46cafe10221e6c345ccb (patch) | |
tree | 9377c4ca367fc95df8ed0ebcd113069e678c1546 /src/internal | |
parent | ac174400f460e9b577079e8606439e0bae62adb0 (diff) | |
download | go-eabf59bc47484e3f09fe46cafe10221e6c345ccb.tar.gz go-eabf59bc47484e3f09fe46cafe10221e6c345ccb.zip |
all: make use of stringslite.{HasPrefix, HasSuffix}
Just a code cleanup.
Change-Id: Ie887ab2c71de11b4844c4e6fd4e5aca3265ac3aa
Reviewed-on: https://go-review.googlesource.com/c/go/+/583216
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Diffstat (limited to 'src/internal')
-rw-r--r-- | src/internal/poll/fd_plan9.go | 5 | ||||
-rw-r--r-- | src/internal/poll/strconv.go | 13 |
2 files changed, 3 insertions, 15 deletions
diff --git a/src/internal/poll/fd_plan9.go b/src/internal/poll/fd_plan9.go index 6659e9dc9b..b65485200a 100644 --- a/src/internal/poll/fd_plan9.go +++ b/src/internal/poll/fd_plan9.go @@ -6,6 +6,7 @@ package poll import ( "errors" + "internal/stringslite" "io" "sync" "syscall" @@ -203,11 +204,11 @@ func (fd *FD) ReadUnlock() { } func isHangup(err error) bool { - return err != nil && stringsHasSuffix(err.Error(), "Hangup") + return err != nil && stringslite.HasSuffix(err.Error(), "Hangup") } func isInterrupted(err error) bool { - return err != nil && stringsHasSuffix(err.Error(), "interrupted") + return err != nil && stringslite.HasSuffix(err.Error(), "interrupted") } // IsPollDescriptor reports whether fd is the descriptor being used by the poller. diff --git a/src/internal/poll/strconv.go b/src/internal/poll/strconv.go deleted file mode 100644 index 2b052fa174..0000000000 --- a/src/internal/poll/strconv.go +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build plan9 - -package poll - -// stringsHasSuffix is strings.HasSuffix. It reports whether s ends in -// suffix. -func stringsHasSuffix(s, suffix string) bool { - return len(s) >= len(suffix) && s[len(s)-len(suffix):] == suffix -} |