diff options
| author | qiulaidongfeng <2645477756@qq.com> | 2025-07-26 12:05:17 +0800 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2025-10-23 11:27:27 -0700 |
| commit | 3f6ac3a10fb09db9cf7c55d84fbbf0bd3968d25d (patch) | |
| tree | 786edda11584682daeb0d5eac838c154bb2fbf2e /src | |
| parent | 839da71f8907ac4434299db4353db31835c916df (diff) | |
| download | go-3f6ac3a10fb09db9cf7c55d84fbbf0bd3968d25d.tar.xz | |
go/build: use slices.Equal
Change-Id: Id10293b6fe7a5916599fd4684430d694bb8c8920
Reviewed-on: https://go-review.googlesource.com/c/go/+/690615
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Sean Liao <sean@liao.dev>
Diffstat (limited to 'src')
| -rw-r--r-- | src/go/build/build.go | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/src/go/build/build.go b/src/go/build/build.go index 76866c7487..68fb8dbbd7 100644 --- a/src/go/build/build.go +++ b/src/go/build/build.go @@ -1139,7 +1139,7 @@ func (ctxt *Context) importGo(p *Package, path, srcDir string, mode ImportMode) // we must not being doing special things like AllowBinary or IgnoreVendor, // and all the file system callbacks must be nil (we're meant to use the local file system). if mode&AllowBinary != 0 || mode&IgnoreVendor != 0 || - ctxt.JoinPath != nil || ctxt.SplitPathList != nil || ctxt.IsAbsPath != nil || ctxt.IsDir != nil || ctxt.HasSubdir != nil || ctxt.ReadDir != nil || ctxt.OpenFile != nil || !equal(ctxt.ToolTags, defaultToolTags) || !equal(ctxt.ReleaseTags, defaultReleaseTags) { + ctxt.JoinPath != nil || ctxt.SplitPathList != nil || ctxt.IsAbsPath != nil || ctxt.IsDir != nil || ctxt.HasSubdir != nil || ctxt.ReadDir != nil || ctxt.OpenFile != nil || !slices.Equal(ctxt.ToolTags, defaultToolTags) || !slices.Equal(ctxt.ReleaseTags, defaultReleaseTags) { return errNoModules } @@ -1279,18 +1279,6 @@ func (ctxt *Context) importGo(p *Package, path, srcDir string, mode ImportMode) return nil } -func equal(x, y []string) bool { - if len(x) != len(y) { - return false - } - for i, xi := range x { - if xi != y[i] { - return false - } - } - return true -} - // hasGoFiles reports whether dir contains any files with names ending in .go. // For a vendor check we must exclude directories that contain no .go files. // Otherwise it is not possible to vendor just a/b/c and still import the |
