From db97d07dbb97ddc130d8b2a51f9bc263f98d78f4 Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Wed, 8 Jul 2026 16:12:09 -0400 Subject: [PATCH 1/3] all: use path for go.mod module path We have various small submodules in the repository, mostly used for code generation tools with external dependencies. Currently naming is fairly ad-hoc. Some name the module based on the path of the directory, while others use a single name like _gen. If a developer creates a go.work file creating a workspace containing these submodules (go work use -r .) [1], then all module names must be unique. Since CL 772102, we have two modules named _gen, so any operation after creating go.work immediately fails with a duplicate module error. Resolve this by using module paths based on the path to the directory. The load bearing changes here are modifying cmd/compile/internal/ssa/_gen/go.mod and/or simd/archsimd/_gen/go.mod so they no longer conflict, but I've changed all module paths to use the same naming scheme for consistency. Note that std and cmd get special treatment by cmd/go, so avoid those prefixes. e.g., the cmd/vet modules seem to ignore the Go language version when using a cmd/ prefix. [1] I found this issue because the build process for cross-references on https://cs.opensource.google/go does this and is currently broken. Change-Id: I8b3a351c16bd6d52192fb7b45186c38f6a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/798560 Auto-Submit: Michael Pratt Reviewed-by: Dmitri Shuralyov LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com Reviewed-by: David Chase --- src/cmd/compile/internal/ssa/_gen/go.mod | 3 ++- src/cmd/vet/testdata/rangeloop/go.mod | 3 ++- src/cmd/vet/testdata/stdversion/go.mod | 3 ++- src/crypto/internal/fips140/aes/_asm/ctr/go.mod | 2 +- src/crypto/internal/fips140/aes/_asm/standard/go.mod | 2 +- src/crypto/internal/fips140/aes/gcm/_asm/gcm/go.mod | 2 +- src/crypto/internal/fips140/sha256/_asm/go.mod | 2 +- src/crypto/internal/fips140/sha3/_asm/go.mod | 2 +- src/crypto/internal/fips140/sha512/_asm/go.mod | 2 +- src/runtime/_mkmalloc/go.mod | 2 +- src/simd/archsimd/_gen/go.mod | 2 +- src/simd/archsimd/_gen/simdgen/arm64/emit.go | 2 +- src/simd/archsimd/_gen/simdgen/arm64/load.go | 2 +- src/simd/archsimd/_gen/simdgen/gen_simdGenericOps.go | 2 +- src/simd/archsimd/_gen/simdgen/gen_simdIntrinsics.go | 2 +- src/simd/archsimd/_gen/simdgen/gen_simdTypes.go | 2 +- src/simd/archsimd/_gen/simdgen/gen_simdrules.go | 2 +- src/simd/archsimd/_gen/simdgen/godefs.go | 2 +- src/simd/archsimd/_gen/simdgen/main.go | 4 ++-- src/simd/archsimd/_gen/simdgen/xed.go | 2 +- src/simd/archsimd/_gen/tmplgen/main.go | 2 +- src/simd/archsimd/_gen/wasmgen/main.go | 2 +- src/simd/testdata/ip/go.mod | 2 +- 23 files changed, 27 insertions(+), 24 deletions(-) diff --git a/src/cmd/compile/internal/ssa/_gen/go.mod b/src/cmd/compile/internal/ssa/_gen/go.mod index 6f750a5618ab27..b8e6449efb2128 100644 --- a/src/cmd/compile/internal/ssa/_gen/go.mod +++ b/src/cmd/compile/internal/ssa/_gen/go.mod @@ -1,4 +1,5 @@ -module _gen +// N.B. cmd/... modules get special treatment, so avoid that prefix. +module compile/internal/ssa/_gen go 1.24 diff --git a/src/cmd/vet/testdata/rangeloop/go.mod b/src/cmd/vet/testdata/rangeloop/go.mod index 178eba2180c3e1..87a1cd55bce9d0 100644 --- a/src/cmd/vet/testdata/rangeloop/go.mod +++ b/src/cmd/vet/testdata/rangeloop/go.mod @@ -1,3 +1,4 @@ -module rangeloop +// N.B. cmd/... modules get special treatment, so avoid that prefix. +module vet/testdata/rangeloop go 1.21 diff --git a/src/cmd/vet/testdata/stdversion/go.mod b/src/cmd/vet/testdata/stdversion/go.mod index 90ae83b840ad9b..93b0f7850eadcf 100644 --- a/src/cmd/vet/testdata/stdversion/go.mod +++ b/src/cmd/vet/testdata/stdversion/go.mod @@ -1,3 +1,4 @@ -module stdversion +// N.B. cmd/... modules get special treatment, so avoid that prefix. +module vet/testdata/stdversion go 1.21 diff --git a/src/crypto/internal/fips140/aes/_asm/ctr/go.mod b/src/crypto/internal/fips140/aes/_asm/ctr/go.mod index 80aac1559c1efa..c1206f49ec73cb 100644 --- a/src/crypto/internal/fips140/aes/_asm/ctr/go.mod +++ b/src/crypto/internal/fips140/aes/_asm/ctr/go.mod @@ -1,4 +1,4 @@ -module crypto/aes/_asm/ctr +module crypto/internal/fips140/aes/_asm/ctr go 1.25 diff --git a/src/crypto/internal/fips140/aes/_asm/standard/go.mod b/src/crypto/internal/fips140/aes/_asm/standard/go.mod index f1329b7290af04..e91f6ab710fbe7 100644 --- a/src/crypto/internal/fips140/aes/_asm/standard/go.mod +++ b/src/crypto/internal/fips140/aes/_asm/standard/go.mod @@ -1,4 +1,4 @@ -module crypto/aes/_asm/standard +module crypto/internal/fips140/aes/_asm/standard go 1.24 diff --git a/src/crypto/internal/fips140/aes/gcm/_asm/gcm/go.mod b/src/crypto/internal/fips140/aes/gcm/_asm/gcm/go.mod index 3fd2094068e897..67ef7fd54a245f 100644 --- a/src/crypto/internal/fips140/aes/gcm/_asm/gcm/go.mod +++ b/src/crypto/internal/fips140/aes/gcm/_asm/gcm/go.mod @@ -1,4 +1,4 @@ -module crypto/aes/_asm/gcm +module crypto/internal/fips140/aes/gcm/_asm/gcm go 1.24 diff --git a/src/crypto/internal/fips140/sha256/_asm/go.mod b/src/crypto/internal/fips140/sha256/_asm/go.mod index eb93418b8a1734..4aca05ad582995 100644 --- a/src/crypto/internal/fips140/sha256/_asm/go.mod +++ b/src/crypto/internal/fips140/sha256/_asm/go.mod @@ -1,4 +1,4 @@ -module crypto/sha256/_asm +module crypto/internal/fips140/sha256/_asm go 1.24 diff --git a/src/crypto/internal/fips140/sha3/_asm/go.mod b/src/crypto/internal/fips140/sha3/_asm/go.mod index 39e83acc943061..27df08c70ae040 100644 --- a/src/crypto/internal/fips140/sha3/_asm/go.mod +++ b/src/crypto/internal/fips140/sha3/_asm/go.mod @@ -1,4 +1,4 @@ -module sha3/_asm +module crypto/internal/fips140/sha3/_asm go 1.22 diff --git a/src/crypto/internal/fips140/sha512/_asm/go.mod b/src/crypto/internal/fips140/sha512/_asm/go.mod index 78b953258b6720..75bfd787667f1f 100644 --- a/src/crypto/internal/fips140/sha512/_asm/go.mod +++ b/src/crypto/internal/fips140/sha512/_asm/go.mod @@ -1,4 +1,4 @@ -module crypto/sha512/_asm +module crypto/internal/fips140/sha512/_asm go 1.24 diff --git a/src/runtime/_mkmalloc/go.mod b/src/runtime/_mkmalloc/go.mod index f6bc431b1e07ea..45c10cf7d665d5 100644 --- a/src/runtime/_mkmalloc/go.mod +++ b/src/runtime/_mkmalloc/go.mod @@ -1,4 +1,4 @@ -module _mkmalloc +module runtime/_mkmalloc go 1.26 diff --git a/src/simd/archsimd/_gen/go.mod b/src/simd/archsimd/_gen/go.mod index 32b075bf421fce..f297b790c9b061 100644 --- a/src/simd/archsimd/_gen/go.mod +++ b/src/simd/archsimd/_gen/go.mod @@ -1,4 +1,4 @@ -module _gen +module simd/archsimd/_gen go 1.25.0 diff --git a/src/simd/archsimd/_gen/simdgen/arm64/emit.go b/src/simd/archsimd/_gen/simdgen/arm64/emit.go index 1bf12815ade9bc..09b92377b25f13 100644 --- a/src/simd/archsimd/_gen/simdgen/arm64/emit.go +++ b/src/simd/archsimd/_gen/simdgen/arm64/emit.go @@ -8,7 +8,7 @@ import ( "fmt" "strings" - "_gen/unify" + "simd/archsimd/_gen/unify" ) // asComment formats text as a comment diff --git a/src/simd/archsimd/_gen/simdgen/arm64/load.go b/src/simd/archsimd/_gen/simdgen/arm64/load.go index 75b4c801137139..aaf2e40fadaa33 100644 --- a/src/simd/archsimd/_gen/simdgen/arm64/load.go +++ b/src/simd/archsimd/_gen/simdgen/arm64/load.go @@ -9,7 +9,7 @@ package arm64 import ( "sort" - "_gen/unify" + "simd/archsimd/_gen/unify" "golang.org/x/arch/arm64/instgen/xmlspec" ) diff --git a/src/simd/archsimd/_gen/simdgen/gen_simdGenericOps.go b/src/simd/archsimd/_gen/simdgen/gen_simdGenericOps.go index b4da36dafe466c..4a8c35066abba8 100644 --- a/src/simd/archsimd/_gen/simdgen/gen_simdGenericOps.go +++ b/src/simd/archsimd/_gen/simdgen/gen_simdGenericOps.go @@ -5,8 +5,8 @@ package main import ( - "_gen/sgutil" "bytes" + "simd/archsimd/_gen/sgutil" ) // writeSIMDGenericOps generates the generic ops for the current architecture, diff --git a/src/simd/archsimd/_gen/simdgen/gen_simdIntrinsics.go b/src/simd/archsimd/_gen/simdgen/gen_simdIntrinsics.go index 4ecbf9f0b77c4e..0f53336afa0907 100644 --- a/src/simd/archsimd/_gen/simdgen/gen_simdIntrinsics.go +++ b/src/simd/archsimd/_gen/simdgen/gen_simdIntrinsics.go @@ -5,9 +5,9 @@ package main import ( - "_gen/sgutil" "bytes" "fmt" + "simd/archsimd/_gen/sgutil" "slices" "text/template" ) diff --git a/src/simd/archsimd/_gen/simdgen/gen_simdTypes.go b/src/simd/archsimd/_gen/simdgen/gen_simdTypes.go index 4024b61f30a0e5..25d53ed0ef3fa5 100644 --- a/src/simd/archsimd/_gen/simdgen/gen_simdTypes.go +++ b/src/simd/archsimd/_gen/simdgen/gen_simdTypes.go @@ -15,7 +15,7 @@ import ( "text/template" "unicode" - "_gen/sgutil" + "simd/archsimd/_gen/sgutil" ) type simdType struct { diff --git a/src/simd/archsimd/_gen/simdgen/gen_simdrules.go b/src/simd/archsimd/_gen/simdgen/gen_simdrules.go index d6e933f87ddc45..a09b208486e7d5 100644 --- a/src/simd/archsimd/_gen/simdgen/gen_simdrules.go +++ b/src/simd/archsimd/_gen/simdgen/gen_simdrules.go @@ -12,7 +12,7 @@ import ( "text/template" "unicode" - "_gen/sgutil" + "simd/archsimd/_gen/sgutil" ) type tplRuleData struct { diff --git a/src/simd/archsimd/_gen/simdgen/godefs.go b/src/simd/archsimd/_gen/simdgen/godefs.go index 59a2154a7e0ed0..5d2764faab191a 100644 --- a/src/simd/archsimd/_gen/simdgen/godefs.go +++ b/src/simd/archsimd/_gen/simdgen/godefs.go @@ -14,7 +14,7 @@ import ( "strings" "unicode" - "_gen/unify" + "simd/archsimd/_gen/unify" ) type Operation struct { diff --git a/src/simd/archsimd/_gen/simdgen/main.go b/src/simd/archsimd/_gen/simdgen/main.go index 276d94869fef68..b1be09e6f0a35c 100644 --- a/src/simd/archsimd/_gen/simdgen/main.go +++ b/src/simd/archsimd/_gen/simdgen/main.go @@ -106,8 +106,8 @@ import ( "slices" "strings" - "_gen/simdgen/arm64" - "_gen/unify" + "simd/archsimd/_gen/simdgen/arm64" + "simd/archsimd/_gen/unify" "gopkg.in/yaml.v3" ) diff --git a/src/simd/archsimd/_gen/simdgen/xed.go b/src/simd/archsimd/_gen/simdgen/xed.go index 5ca8a4dceda887..6e01b66da51252 100644 --- a/src/simd/archsimd/_gen/simdgen/xed.go +++ b/src/simd/archsimd/_gen/simdgen/xed.go @@ -14,7 +14,7 @@ import ( "strconv" "strings" - "_gen/unify" + "simd/archsimd/_gen/unify" "golang.org/x/arch/x86/xeddata" "gopkg.in/yaml.v3" diff --git a/src/simd/archsimd/_gen/tmplgen/main.go b/src/simd/archsimd/_gen/tmplgen/main.go index de7352a085247f..ddb667f3fa55c4 100644 --- a/src/simd/archsimd/_gen/tmplgen/main.go +++ b/src/simd/archsimd/_gen/tmplgen/main.go @@ -8,7 +8,6 @@ package main // slice operations and tests import ( - "_gen/sgutil" "bufio" "bytes" "flag" @@ -16,6 +15,7 @@ import ( "go/format" "io" "os" + "simd/archsimd/_gen/sgutil" "strings" "text/template" ) diff --git a/src/simd/archsimd/_gen/wasmgen/main.go b/src/simd/archsimd/_gen/wasmgen/main.go index b73cff8071154a..0e39c5632a0f88 100644 --- a/src/simd/archsimd/_gen/wasmgen/main.go +++ b/src/simd/archsimd/_gen/wasmgen/main.go @@ -16,7 +16,7 @@ import ( "text/template" "unicode" - "_gen/sgutil" + "simd/archsimd/_gen/sgutil" ) var ( diff --git a/src/simd/testdata/ip/go.mod b/src/simd/testdata/ip/go.mod index f82bc93578c9a4..2c6447dc096b25 100644 --- a/src/simd/testdata/ip/go.mod +++ b/src/simd/testdata/ip/go.mod @@ -1,3 +1,3 @@ -module ip +module simd/testdata/ip go 1.27 From ee05e88ea640b877de84f67279a8529401c03c3a Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Thu, 9 Jul 2026 15:49:25 -0400 Subject: [PATCH 2/3] simd: remove simd/testdata/ip As far as I can tell, this is dead code. Change-Id: Ibd1c30197a785ade97bb2c98a9cfdd5b6a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/799020 LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com Auto-Submit: Michael Pratt Reviewed-by: David Chase --- src/simd/testdata/ip/boringsum.go | 19 ------------ src/simd/testdata/ip/go.mod | 3 -- src/simd/testdata/ip/main.go | 51 ------------------------------- src/simd/testdata/ip/sum.go | 15 --------- src/simd/testdata/ip/sum_amd64.go | 31 ------------------- 5 files changed, 119 deletions(-) delete mode 100644 src/simd/testdata/ip/boringsum.go delete mode 100644 src/simd/testdata/ip/go.mod delete mode 100644 src/simd/testdata/ip/main.go delete mode 100644 src/simd/testdata/ip/sum.go delete mode 100644 src/simd/testdata/ip/sum_amd64.go diff --git a/src/simd/testdata/ip/boringsum.go b/src/simd/testdata/ip/boringsum.go deleted file mode 100644 index 0dc58683fbc972..00000000000000 --- a/src/simd/testdata/ip/boringsum.go +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2026 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. - -package main - -import ( - "simd" -) - -func boringSum(x simd.Float32s) float32 { - s := make([]float32, x.Len()) - x.Store(s) - var r float32 - for _, e := range s { - r += e - } - return r -} diff --git a/src/simd/testdata/ip/go.mod b/src/simd/testdata/ip/go.mod deleted file mode 100644 index 2c6447dc096b25..00000000000000 --- a/src/simd/testdata/ip/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module simd/testdata/ip - -go 1.27 diff --git a/src/simd/testdata/ip/main.go b/src/simd/testdata/ip/main.go deleted file mode 100644 index 94656b995c49f2..00000000000000 --- a/src/simd/testdata/ip/main.go +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2026 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. - -package main - -import ( - "fmt" - "simd" -) - -var sumWidth int -var emulated bool - -func main() { - var a, b [50]float32 - for i := 0; i < 50; i++ { - a[i] = float32(i) - b[i] = float32(i) - } - fmt.Println(ip(a[:5], b[:5])) - fmt.Println(ip(a[:10], b[:10])) - fmt.Println(ip(a[:20], b[:20])) - fmt.Println(ip(a[:30], b[:30])) - fmt.Println(ip(a[:40], b[:40])) - fmt.Println(ip(a[:50], b[:50])) - - fmt.Printf("sum was computed in width %d, emulated = %v\n", sumWidth, emulated) -} - -func first[T, U any](t T, u U) T { - return t -} - -func ip(x, y []float32) float32 { - var a simd.Float32s - sumWidth = a.Len() * 32 - emulated = simd.Emulated() - var i int - for i = 0; i < len(x)-a.Len()+1; i += a.Len() { - u := simd.LoadFloat32s(x[i : i+a.Len()]) - v := simd.LoadFloat32s(y[i : i+a.Len()]) - a = a.Add(u.Mul(v)) - } - if i < len(x) { - a = a.Add(first(simd.LoadFloat32sPart(x[i:])). - Mul(first(simd.LoadFloat32sPart(y[i:])))) - } - - return sum(a) -} diff --git a/src/simd/testdata/ip/sum.go b/src/simd/testdata/ip/sum.go deleted file mode 100644 index ffa3e9b396ef59..00000000000000 --- a/src/simd/testdata/ip/sum.go +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2026 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 !amd64 - -package main - -import ( - "simd" -) - -func sum(x simd.Float32s) float32 { - return boringSum(x) -} diff --git a/src/simd/testdata/ip/sum_amd64.go b/src/simd/testdata/ip/sum_amd64.go deleted file mode 100644 index 64f76575e06b99..00000000000000 --- a/src/simd/testdata/ip/sum_amd64.go +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2026 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 amd64 - -package main - -import ( - "simd" - "simd/archsimd" -) - -func sum(x simd.Float32s) float32 { - switch a := x.ToArch().(type) { - case archsimd.Float32x8: - a = a.ConcatAddPairsGrouped(a) - a = a.ConcatAddPairsGrouped(a) - return a.GetLo().GetElem(0) + a.GetHi().GetElem(0) - case archsimd.Float32x16: - b := a.GetLo().Add(a.GetHi()) - b = b.ConcatAddPairsGrouped(b) - b = b.ConcatAddPairsGrouped(b) - return b.GetLo().GetElem(0) + b.GetHi().GetElem(0) - case archsimd.Float32x4: - return boringSum(simd.Float32sFromArch(a)) - default: - return boringSum(x) - } - panic("nope") -} From 63d836396a47651fbdbb8cd1fa07749e29f8b844 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Thu, 9 Jul 2026 17:07:10 +0200 Subject: [PATCH 3/3] os: strip trailing slashes in RemoveAll on Plan 9 CL 797880 changed Root to handle trailing slashes in paths and added TestRootConsistencyRemoveAll. However, this test is failing on Plan 9 because the "noat" implementation of RemoveAll disagrees with Root.RemoveAll when a path ends in a slash and its target is not a directory. Root.RemoveAll strips the trailing slash and removes the file, while os.RemoveAll leaves the slash in place. On Plan 9, Remove and Lstat then fail on the slash-terminated path, so os.RemoveAll returns an error instead. This change strips trailing slashes in the "noat" implementation of RemoveAll, so RemoveAll("not_a_directory/") removes the file and returns nil, and remains consistent with the "at" implementation and Root.RemoveAll. Fixes #80319. Change-Id: I5c47ccd239c629da78772f39a831cccf8c9d1500 Reviewed-on: https://go-review.googlesource.com/c/go/+/798721 Reviewed-by: Dmitri Shuralyov Reviewed-by: Richard Miller Reviewed-by: Damien Neil Auto-Submit: Damien Neil LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com --- src/os/removeall_noat.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/os/removeall_noat.go b/src/os/removeall_noat.go index 395a1503d49442..8e23df94af42ff 100644 --- a/src/os/removeall_noat.go +++ b/src/os/removeall_noat.go @@ -19,6 +19,12 @@ func removeAll(path string) error { return nil } + // Consistency with Root.RemoveAll: Strip trailing /s from the path, + // so RemoveAll("not_a_directory/") succeeds. + for len(path) > 1 && IsPathSeparator(path[len(path)-1]) { + path = path[:len(path)-1] + } + // The rmdir system call permits removing "." on Plan 9, // so we don't permit it to remain consistent with the // "at" implementation of RemoveAll.