diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 51783d66..ba772e3d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,7 +25,7 @@ jobs: test: strategy: matrix: - go-version: [1.22.x, 1.23.x] + go-version: [1.23.x] os: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.os }} steps: diff --git a/README.md b/README.md index e3460f51..12007730 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ go install mvdan.cc/garble@latest -Obfuscate Go code by wrapping the Go toolchain. Requires Go 1.22 or later. +Obfuscate Go code by wrapping the Go toolchain. Requires Go 1.23 or later. garble build [build flags] [packages] diff --git a/go.mod b/go.mod index f2ee326e..b490ad2e 100644 --- a/go.mod +++ b/go.mod @@ -1,20 +1,20 @@ module mvdan.cc/garble -go 1.22 +go 1.23 require ( - github.com/bluekeyes/go-gitdiff v0.7.1 + github.com/bluekeyes/go-gitdiff v0.8.0 github.com/go-quicktest/qt v1.101.0 github.com/google/go-cmp v0.6.0 - github.com/rogpeppe/go-internal v1.12.0 - golang.org/x/exp v0.0.0-20240823005443-9b4947da3948 - golang.org/x/mod v0.20.0 - golang.org/x/tools v0.24.0 + github.com/rogpeppe/go-internal v1.13.1 + golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c + golang.org/x/mod v0.21.0 + golang.org/x/tools v0.26.0 ) require ( github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.23.0 // indirect + golang.org/x/sys v0.26.0 // indirect ) diff --git a/go.sum b/go.sum index 982b10bb..d812373f 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -github.com/bluekeyes/go-gitdiff v0.7.1 h1:graP4ElLRshr8ecu0UtqfNTCHrtSyZd3DABQm/DWesQ= -github.com/bluekeyes/go-gitdiff v0.7.1/go.mod h1:QpfYYO1E0fTVHVZAZKiRjtSGY9823iCdvGXBcEzHGbM= +github.com/bluekeyes/go-gitdiff v0.8.0 h1:Nn1wfw3/XeKoc3lWk+2bEXGUHIx36kj80FM1gVcBk+o= +github.com/bluekeyes/go-gitdiff v0.8.0/go.mod h1:WWAk1Mc6EgWarCrPFO+xeYlujPu98VuLW3Tu+B/85AE= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/go-quicktest/qt v1.101.0 h1:O1K29Txy5P2OK0dGo59b7b0LR6wKfIhttaAhHUyn7eI= github.com/go-quicktest/qt v1.101.0/go.mod h1:14Bz/f7NwaXPtdYEgzsx46kqSxVwTbzVZsDC26tQJow= @@ -11,15 +11,15 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= -github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= -golang.org/x/exp v0.0.0-20240823005443-9b4947da3948 h1:kx6Ds3MlpiUHKj7syVnbp57++8WpuKPcR5yjLBjvLEA= -golang.org/x/exp v0.0.0-20240823005443-9b4947da3948/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ= -golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0= -golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= +golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c h1:7dEasQXItcW1xKJ2+gg5VOiBnqWrJc+rq0DPKyvvdbY= +golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c/go.mod h1:NQtJDoLvd6faHhE7m4T/1IY708gDefGGjR/iUW8yQQ8= +golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= +golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sys v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM= -golang.org/x/sys v0.23.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24= -golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= diff --git a/go_std_tables.go b/go_std_tables.go index 048b5243..2cd60f4b 100644 --- a/go_std_tables.go +++ b/go_std_tables.go @@ -1,6 +1,6 @@ // Code generated by scripts/gen_go_std_tables.go; DO NOT EDIT. -// Generated from Go versions [go1.23.0 go1.22.6]. +// Generated from Go versions [go1.23.0]. package main @@ -21,10 +21,8 @@ var runtimeAndDeps = map[string]bool{ "internal/runtime/syscall": true, // go1.23.0 "internal/stringslite": true, // go1.23.0 "runtime": true, // go1.23.0 - "runtime/internal/atomic": true, // go1.22.6 "runtime/internal/math": true, // go1.23.0 "runtime/internal/sys": true, // go1.23.0 - "runtime/internal/syscall": true, // go1.22.6 "unsafe": true, // go1.23.0 } @@ -46,7 +44,6 @@ var runtimeLinknamed = []string{ "os/signal", // go1.23.0 "plugin", // go1.23.0 "reflect", // go1.23.0 - "runtime/coverage", // go1.22.6 "runtime/debug", // go1.23.0 "runtime/metrics", // go1.23.0 "runtime/pprof", // go1.23.0 @@ -167,50 +164,6 @@ var compilerIntrinsics = map[string]map[string]bool{ "runtime": { "publicationBarrier": true, // go1.23.0 }, - "runtime/internal/atomic": { - "And": true, // go1.22.6 - "And8": true, // go1.22.6 - "Cas": true, // go1.22.6 - "Cas64": true, // go1.22.6 - "CasRel": true, // go1.22.6 - "Casint32": true, // go1.22.6 - "Casint64": true, // go1.22.6 - "Casp1": true, // go1.22.6 - "Casuintptr": true, // go1.22.6 - "Load": true, // go1.22.6 - "Load64": true, // go1.22.6 - "Load8": true, // go1.22.6 - "LoadAcq": true, // go1.22.6 - "LoadAcq64": true, // go1.22.6 - "LoadAcquintptr": true, // go1.22.6 - "Loadint32": true, // go1.22.6 - "Loadint64": true, // go1.22.6 - "Loadp": true, // go1.22.6 - "Loaduint": true, // go1.22.6 - "Loaduintptr": true, // go1.22.6 - "Or": true, // go1.22.6 - "Or8": true, // go1.22.6 - "Store": true, // go1.22.6 - "Store64": true, // go1.22.6 - "Store8": true, // go1.22.6 - "StoreRel": true, // go1.22.6 - "StoreRel64": true, // go1.22.6 - "StoreReluintptr": true, // go1.22.6 - "Storeint32": true, // go1.22.6 - "Storeint64": true, // go1.22.6 - "StorepNoWB": true, // go1.22.6 - "Storeuintptr": true, // go1.22.6 - "Xadd": true, // go1.22.6 - "Xadd64": true, // go1.22.6 - "Xaddint32": true, // go1.22.6 - "Xaddint64": true, // go1.22.6 - "Xadduintptr": true, // go1.22.6 - "Xchg": true, // go1.22.6 - "Xchg64": true, // go1.22.6 - "Xchgint32": true, // go1.22.6 - "Xchgint64": true, // go1.22.6 - "Xchguintptr": true, // go1.22.6 - }, "runtime/internal/math": { "MulUintptr": true, // go1.23.0 }, diff --git a/internal/linker/patches/go1.22/0001-add-custom-magic-value.patch b/internal/linker/patches/go1.22/0001-add-custom-magic-value.patch deleted file mode 100644 index a40aa432..00000000 --- a/internal/linker/patches/go1.22/0001-add-custom-magic-value.patch +++ /dev/null @@ -1,36 +0,0 @@ -From ef30d58213cf765d0e02eb3b4e151b170fb9fd6b Mon Sep 17 00:00:00 2001 -From: pagran -Date: Mon, 9 Jan 2023 13:30:00 +0100 -Subject: [PATCH 1/3] add custom magic value - ---- - cmd/link/internal/ld/pcln.go | 13 +++++++++++++ - 1 file changed, 13 insertions(+) - -diff --git a/cmd/link/internal/ld/pcln.go b/cmd/link/internal/ld/pcln.go -index 5734b92507..0f95ad928b 100644 ---- a/cmd/link/internal/ld/pcln.go -+++ b/cmd/link/internal/ld/pcln.go -@@ -263,6 +263,19 @@ func (state *pclntab) generatePCHeader(ctxt *Link) { - if off != size { - panic(fmt.Sprintf("pcHeader size: %d != %d", off, size)) - } -+ -+ // Use garble prefix in variable names to minimize collision risk -+ garbleMagicStr := os.Getenv("GARBLE_LINK_MAGIC") -+ if garbleMagicStr == "" { -+ panic("[garble] magic value must be set") -+ } -+ var garbleMagicVal uint32 -+ // Use fmt package instead of strconv to avoid importing a new package -+ if _, err := fmt.Sscan(garbleMagicStr, &garbleMagicVal); err != nil { -+ panic(fmt.Errorf("[garble] invalid magic value %s: %v", garbleMagicStr, err)) -+ } -+ -+ header.SetUint32(ctxt.Arch, 0, garbleMagicVal) - } - - state.pcheader = state.addGeneratedSym(ctxt, "runtime.pcheader", size, writeHeader) --- -2.43.0 - diff --git a/internal/linker/patches/go1.22/0002-add-unexported-function-name-removing.patch b/internal/linker/patches/go1.22/0002-add-unexported-function-name-removing.patch deleted file mode 100644 index 5a20ca0d..00000000 --- a/internal/linker/patches/go1.22/0002-add-unexported-function-name-removing.patch +++ /dev/null @@ -1,85 +0,0 @@ -From fef657296f1f1b51b73b4e715af4ce9569d05bae Mon Sep 17 00:00:00 2001 -From: pagran -Date: Mon, 9 Jan 2023 13:30:36 +0100 -Subject: [PATCH 2/3] add unexported function name removing - ---- - cmd/link/internal/ld/pcln.go | 43 +++++++++++++++++++++++++++++++++++- - 1 file changed, 42 insertions(+), 1 deletion(-) - -diff --git a/cmd/link/internal/ld/pcln.go b/cmd/link/internal/ld/pcln.go -index 0f95ad928b..6bfa03da87 100644 ---- a/cmd/link/internal/ld/pcln.go -+++ b/cmd/link/internal/ld/pcln.go -@@ -4,6 +4,10 @@ - - package ld - -+import ( -+ "unicode" -+) -+ - import ( - "cmd/internal/goobj" - "cmd/internal/objabi" -@@ -315,19 +319,56 @@ func walkFuncs(ctxt *Link, funcs []loader.Sym, f func(loader.Sym)) { - func (state *pclntab) generateFuncnametab(ctxt *Link, funcs []loader.Sym) map[loader.Sym]uint32 { - nameOffsets := make(map[loader.Sym]uint32, state.nfunc) - -+ garbleTiny := os.Getenv("GARBLE_LINK_TINY") == "true" -+ - // Write the null terminated strings. - writeFuncNameTab := func(ctxt *Link, s loader.Sym) { - symtab := ctxt.loader.MakeSymbolUpdater(s) -+ if garbleTiny { -+ symtab.AddStringAt(0, "") -+ } -+ - for s, off := range nameOffsets { -+ if garbleTiny && off == 0 { -+ continue -+ } - symtab.AddCStringAt(int64(off), ctxt.loader.SymName(s)) - } - } - - // Loop through the CUs, and calculate the size needed. - var size int64 -+ -+ if garbleTiny { -+ size = 1 // first byte is reserved for empty string used for all non-exportable method names -+ } -+ // Kinds of SymNames found in the wild: -+ // -+ // * reflect.Value.CanAddr -+ // * reflect.(*Value).String -+ // * reflect.w6cEoKc -+ // * internal/abi.(*RegArgs).IntRegArgAddr -+ // * type:.eq.runtime.special -+ // * runtime/internal/atomic.(*Pointer[go.shape.string]).Store -+ // -+ // Checking whether the first rune after the last dot is uppercase seems enough. -+ isExported := func(name string) bool { -+ for _, r := range name[strings.LastIndexByte(name, '.')+1:] { -+ return unicode.IsUpper(r) -+ } -+ return false -+ } -+ - walkFuncs(ctxt, funcs, func(s loader.Sym) { -+ name := ctxt.loader.SymName(s) -+ -+ if garbleTiny && !isExported(name) { -+ nameOffsets[s] = 0 // redirect name to empty string -+ return -+ } -+ - nameOffsets[s] = uint32(size) -- size += int64(len(ctxt.loader.SymName(s)) + 1) // NULL terminate -+ size += int64(len(name) + 1) // NULL terminate - }) - - state.funcnametab = state.addGeneratedSym(ctxt, "runtime.funcnametab", size, writeFuncNameTab) --- -2.43.0 - diff --git a/internal/linker/patches/go1.22/0003-add-entryOff-encryption.patch b/internal/linker/patches/go1.22/0003-add-entryOff-encryption.patch deleted file mode 100644 index f03c2a37..00000000 --- a/internal/linker/patches/go1.22/0003-add-entryOff-encryption.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 49f31a321c5b2d082981428abbb5d53e244c4200 Mon Sep 17 00:00:00 2001 -From: pagran -Date: Sat, 14 Jan 2023 21:36:16 +0100 -Subject: [PATCH 3/3] add entryOff encryption - ---- - cmd/link/internal/ld/pcln.go | 20 ++++++++++++++++++++ - 1 file changed, 20 insertions(+) - -diff --git a/cmd/link/internal/ld/pcln.go b/cmd/link/internal/ld/pcln.go -index 6bfa03da87..538cba32db 100644 ---- a/cmd/link/internal/ld/pcln.go -+++ b/cmd/link/internal/ld/pcln.go -@@ -803,6 +803,26 @@ func writeFuncs(ctxt *Link, sb *loader.SymbolBuilder, funcs []loader.Sym, inlSym - sb.SetUint32(ctxt.Arch, dataoff, uint32(ldr.SymValue(fdsym)-gofuncBase)) - } - } -+ -+ // Moving next code higher is not recommended. -+ // Only at the end of the current function no edits between go versions -+ garbleEntryOffKeyStr := os.Getenv("GARBLE_LINK_ENTRYOFF_KEY") -+ if garbleEntryOffKeyStr == "" { -+ panic("[garble] entryOff key must be set") -+ } -+ var garbleEntryOffKey uint32 -+ // Use fmt package instead of strconv to avoid importing a new package -+ if _, err := fmt.Sscan(garbleEntryOffKeyStr, &garbleEntryOffKey); err != nil { -+ panic(fmt.Errorf("[garble] invalid entryOff key %s: %v", garbleEntryOffKeyStr, err)) -+ } -+ -+ garbleData := sb.Data() -+ for _, off := range startLocations { -+ entryOff := ctxt.Arch.ByteOrder.Uint32(garbleData[off:]) -+ nameOff := ctxt.Arch.ByteOrder.Uint32(garbleData[off+4:]) -+ -+ sb.SetUint32(ctxt.Arch, int64(off), entryOff^(nameOff*garbleEntryOffKey)) -+ } - } - - // pclntab initializes the pclntab symbol with --- -2.43.0 - diff --git a/internal/ssa2ast/type.go b/internal/ssa2ast/type.go index fc7f70f7..162d949e 100644 --- a/internal/ssa2ast/type.go +++ b/internal/ssa2ast/type.go @@ -17,8 +17,8 @@ func NewTypeConverted(resolver ImportNameResolver) *TypeConverter { return &TypeConverter{resolver: resolver} } -func (tc *TypeConverter) Convert(t types.Type) (ast.Expr, error) { - switch typ := t.(type) { +func (tc *TypeConverter) Convert(typ types.Type) (ast.Expr, error) { + switch typ := types.Unalias(typ).(type) { case *types.Array: eltExpr, err := tc.Convert(typ.Elem()) if err != nil { diff --git a/main.go b/main.go index 0de5a2f8..64a809b8 100644 --- a/main.go +++ b/main.go @@ -269,7 +269,7 @@ func (e errJustExit) Error() string { return fmt.Sprintf("exit: %d", e) } func goVersionOK() bool { const ( - minGoVersion = "go1.22" // the first major version we support + minGoVersion = "go1.23" // the first major version we support maxGoVersion = "go1.24" // the first major version we don't support ) @@ -314,6 +314,11 @@ garble was built with %q and can't be used with the newer %q; rebuild it with a } func mainErr(args []string) error { + // TODO(mvdan): until we can rely on alias tracking to work reliably, + // we must turn it off so that we don't get inconsistent types. + // See: https://go.dev/issue/70394 + os.Setenv("GODEBUG", "gotypesalias=0") + command, args := args[0], args[1:] // Catch users reaching for `go build -toolexec=garble`. @@ -1709,6 +1714,8 @@ func recordType(used, origin types.Type, done map[*types.Named]bool, fieldToStru if origin == nil { origin = used } + origin = types.Unalias(origin) + used = types.Unalias(used) type Container interface{ Elem() types.Type } switch used := used.(type) { case Container: @@ -1748,8 +1755,8 @@ func recordType(used, origin types.Type, done map[*types.Named]bool, fieldToStru // isSafeForInstanceType returns true if the passed type is safe for var declaration. // Unsafe types: generic types and non-method interfaces. -func isSafeForInstanceType(typ types.Type) bool { - switch t := typ.(type) { +func isSafeForInstanceType(t types.Type) bool { + switch t := types.Unalias(t).(type) { case *types.Named: if t.TypeParams().Len() > 0 { return false @@ -1918,11 +1925,11 @@ func (tf *transformer) transformGoFile(file *ast.File) *ast.File { } obj = tname } else { - named := namedType(obj.Type()) - if named == nil { + tname := namedType(obj.Type()) + if tname == nil { return true // unnamed type (probably a basic type, e.g. int) } - obj = named.Obj() + obj = tname } pkg = obj.Pkg() } @@ -2080,14 +2087,17 @@ func (tf *transformer) transformGoFile(file *ast.File) *ast.File { return astutil.Apply(file, pre, post).(*ast.File) } -// named tries to obtain the *types.Named behind a type, if there is one. +// namedType tries to obtain the *types.TypeName behind a type, if there is one. // This is useful to obtain "testing.T" from "*testing.T", or to obtain the type // declaration object from an embedded field. -func namedType(t types.Type) *types.Named { +// Note that, for a type alias, this gives the alias name. +func namedType(t types.Type) *types.TypeName { switch t := t.(type) { + case *types.Alias: + return t.Obj() case *types.Named: - return t - case interface{ Elem() types.Type }: + return t.Obj() + case *types.Pointer: return namedType(t.Elem()) default: return nil @@ -2103,12 +2113,11 @@ func isTestSignature(sign *types.Signature) bool { if params.Len() != 1 { return false // too many parameters for a test func } - named := namedType(params.At(0).Type()) - if named == nil { + tname := namedType(params.At(0).Type()) + if tname == nil { return false // the only parameter isn't named, like "string" } - obj := named.Obj() - return obj != nil && obj.Pkg().Path() == "testing" && obj.Name() == "T" + return tname.Pkg().Path() == "testing" && tname.Name() == "T" } func (tf *transformer) transformLink(args []string) ([]string, error) { diff --git a/scripts/gen_go_std_tables.go b/scripts/gen_go_std_tables.go index f0dd6142..f46ba88b 100644 --- a/scripts/gen_go_std_tables.go +++ b/scripts/gen_go_std_tables.go @@ -20,7 +20,7 @@ import ( "text/template" ) -var goVersions = []string{"go1.23.0", "go1.22.6"} +var goVersions = []string{"go1.23.0"} var tmplTables = template.Must(template.New("").Parse(` // Code generated by scripts/gen_go_std_tables.go; DO NOT EDIT. diff --git a/testdata/script/asm.txtar b/testdata/script/asm.txtar index 210dfcb2..0bb57567 100644 --- a/testdata/script/asm.txtar +++ b/testdata/script/asm.txtar @@ -33,7 +33,7 @@ binsubstr main$exe 'addJmp' 'AddImpl' -- go.mod -- module test/with.many.dots/main -go 1.22 +go 1.23 -- main.go -- package main diff --git a/testdata/script/atomic.txtar b/testdata/script/atomic.txtar index 0b62b552..813c2401 100644 --- a/testdata/script/atomic.txtar +++ b/testdata/script/atomic.txtar @@ -18,7 +18,7 @@ cmp stderr main.stderr -- go.mod -- module test/main -go 1.22 +go 1.23 -- main.go -- package main diff --git a/testdata/script/basic.txtar b/testdata/script/basic.txtar index c294f664..f2093af8 100644 --- a/testdata/script/basic.txtar +++ b/testdata/script/basic.txtar @@ -59,7 +59,7 @@ binsubstr main$exe 'garble_main.go' 'globalVar' 'globalFunc' $gofullversion -- go.mod -- module test/mainfoo -go 1.22 +go 1.23 -- garble_main.go -- package main diff --git a/testdata/script/cache.txtar b/testdata/script/cache.txtar index ea2b096c..6f5c2ec1 100644 --- a/testdata/script/cache.txtar +++ b/testdata/script/cache.txtar @@ -28,7 +28,7 @@ cmp stderr main.stderr -- go.mod -- module test/main -go 1.22 +go 1.23 -- main.go -- package main diff --git a/testdata/script/cgo.txtar b/testdata/script/cgo.txtar index 350fc279..f39c991e 100644 --- a/testdata/script/cgo.txtar +++ b/testdata/script/cgo.txtar @@ -29,7 +29,7 @@ binsubstr main$exe 'privateAdd' -- go.mod -- module test/main -go 1.22 +go 1.23 -- main.go -- package main diff --git a/testdata/script/crossbuild.txtar b/testdata/script/crossbuild.txtar index 42223a9e..2535aec2 100644 --- a/testdata/script/crossbuild.txtar +++ b/testdata/script/crossbuild.txtar @@ -31,7 +31,7 @@ exec garble build -- go.mod -- module test/main -go 1.22 +go 1.23 -- main.go -- package main diff --git a/testdata/script/ctrlflow.txtar b/testdata/script/ctrlflow.txtar index f75e6581..57800d69 100644 --- a/testdata/script/ctrlflow.txtar +++ b/testdata/script/ctrlflow.txtar @@ -30,7 +30,7 @@ grep 'func\(int\) int' $WORK/debug/test/main/GARBLE_controlflow.go -- go.mod -- module test/main -go 1.22 +go 1.23 -- garble_main.go -- package main diff --git a/testdata/script/debugdir.txtar b/testdata/script/debugdir.txtar index c62a2cf7..fc123acc 100644 --- a/testdata/script/debugdir.txtar +++ b/testdata/script/debugdir.txtar @@ -18,7 +18,7 @@ stderr 'test/main' # we force rebuilds with -debugdir -- go.mod -- module test/main -go 1.22 +go 1.23 -- main.go -- package main diff --git a/testdata/script/embed.txtar b/testdata/script/embed.txtar index 7418fe34..8507bf48 100644 --- a/testdata/script/embed.txtar +++ b/testdata/script/embed.txtar @@ -11,7 +11,7 @@ cmp stdout main.stdout -- go.mod -- module test/main -go 1.22 +go 1.23 -- main.go -- package main diff --git a/testdata/script/goenv.txtar b/testdata/script/goenv.txtar index 6dbc72e1..416ed573 100644 --- a/testdata/script/goenv.txtar +++ b/testdata/script/goenv.txtar @@ -46,7 +46,7 @@ exec $NAME/garble$exe build -- go.mod -- module test/main -go 1.22 +go 1.23 -- main.go -- package main diff --git a/testdata/script/gogarble.txtar b/testdata/script/gogarble.txtar index 270fbdf9..32194a81 100644 --- a/testdata/script/gogarble.txtar +++ b/testdata/script/gogarble.txtar @@ -54,7 +54,7 @@ bincmp out_rebuild out -- go.mod -- module test/main -go 1.22 +go 1.23 -- standalone/main.go -- package main diff --git a/testdata/script/goversion.txtar b/testdata/script/goversion.txtar index 51e294f9..f0329e93 100644 --- a/testdata/script/goversion.txtar +++ b/testdata/script/goversion.txtar @@ -7,30 +7,30 @@ env PATH=${WORK}/.bin${:}${PATH} # An empty go version. env TOOLCHAIN_GOVERSION='' ! exec garble build -stderr 'Go version is too old; please upgrade to go1\.22 or newer' +stderr 'Go version is too old; please upgrade to go1\.23 or newer' # We should error on a devel version that's too old. # Note that they lacked the "goN.M-" prefix. env TOOLCHAIN_GOVERSION='devel +afb5fca Sun Aug 07 00:00:00 2020 +0000' ! exec garble build -stderr 'Go version is too old; please upgrade to go1\.22 or newer' +stderr 'Go version is too old; please upgrade to go1\.23 or newer' # Another form of old version; with an old "goN.M-" prefix. env TOOLCHAIN_GOVERSION='devel go1.15-afb5fca Sun Aug 07 00:00:00 2020 +0000' ! exec garble build -stderr 'Go version "devel go1\.15-.*2020.*" is too old; please upgrade to go1\.22' +stderr 'Go version "devel go1\.15-.*2020.*" is too old; please upgrade to go1\.23' # A current devel version should be fine. # Note that we don't look at devel version timestamps. -env GARBLE_TEST_GOVERSION='go1.22' -env TOOLCHAIN_GOVERSION='devel go1.22-ad97d204f0 Sun Sep 12 16:46:58 2023 +0000' +env GARBLE_TEST_GOVERSION='go1.23.0' +env TOOLCHAIN_GOVERSION='devel go1.23-ad97d204f0 Sun Sep 12 16:46:58 2023 +0000' ! exec garble build stderr 'mocking the real build' # We should error on a stable version that's too old. env TOOLCHAIN_GOVERSION='go1.14' ! exec garble build -stderr 'Go version "go1\.14" is too old; please upgrade to go1\.22 or newer' +stderr 'Go version "go1\.14" is too old; please upgrade to go1\.23 or newer' # We should reject a future stable version, as we don't have linker patches yet. # Note that we need to bump the version of Go that supposedly built it, too. @@ -40,45 +40,45 @@ env TOOLCHAIN_GOVERSION='go1.28.2' stderr 'Go version "go1\.28\.2" is too new; Go linker patches aren''t available for go1\.24 or later yet' # We should accept custom devel strings. -env TOOLCHAIN_GOVERSION='devel go1.22-somecustomversion' +env TOOLCHAIN_GOVERSION='devel go1.23-somecustomversion' ! exec garble build stderr 'mocking the real build' # The current toolchain may be older than the one that built garble. -env GARBLE_TEST_GOVERSION='go1.23' -env TOOLCHAIN_GOVERSION='go1.22.3' +env GARBLE_TEST_GOVERSION='go1.23.2' +env TOOLCHAIN_GOVERSION='go1.23.1' ! exec garble build stderr 'mocking the real build' # The current toolchain may be equal to the one that built garble. -env GARBLE_TEST_GOVERSION='devel go1.22-6673d5d701 Sun Mar 20 16:05:03 2023 +0000' -env TOOLCHAIN_GOVERSION='devel go1.22-6673d5d701 Sun Mar 20 16:05:03 2023 +0000' +env GARBLE_TEST_GOVERSION='devel go1.23-6673d5d701 Sun Mar 20 16:05:03 2023 +0000' +env TOOLCHAIN_GOVERSION='devel go1.23-6673d5d701 Sun Mar 20 16:05:03 2023 +0000' ! exec garble build stderr 'mocking the real build' # The current toolchain must not be newer than the one that built garble. env GARBLE_TEST_GOVERSION='go1.18' -env TOOLCHAIN_GOVERSION='go1.22.1' +env TOOLCHAIN_GOVERSION='go1.23.1' ! exec garble build -stderr 'garble was built with "go1\.18" and can''t be used with the newer "go1\.22\.1"; rebuild ' +stderr 'garble was built with "go1\.18" and can''t be used with the newer "go1\.23\.1"; rebuild ' # We'll error even if the difference is a minor (bugfix) level. # In practice it probably wouldn't matter, but in theory it could still lead to tricky bugs. -env GARBLE_TEST_GOVERSION='go1.22.11' -env TOOLCHAIN_GOVERSION='go1.22.14' +env GARBLE_TEST_GOVERSION='go1.23.11' +env TOOLCHAIN_GOVERSION='go1.23.14' ! exec garble build -stderr 'garble was built with "go1\.22\.11" and can''t be used with the newer "go1\.22\.14"; rebuild ' +stderr 'garble was built with "go1\.23\.11" and can''t be used with the newer "go1\.23\.14"; rebuild ' # If garble builds itself and is then used, it won't know what version built it. # As a fallback, we drop the comparison against the toolchain's version. env GARBLE_TEST_GOVERSION='bogus version' -env TOOLCHAIN_GOVERSION='go1.22.3' +env TOOLCHAIN_GOVERSION='go1.23.3' ! exec garble build stderr 'mocking the real build' -- go.mod -- module test/main -go 1.22 +go 1.23 -- main.go -- package main diff --git a/testdata/script/help.txtar b/testdata/script/help.txtar index 8f252607..3f324a82 100644 --- a/testdata/script/help.txtar +++ b/testdata/script/help.txtar @@ -117,6 +117,6 @@ stderr 'usage: garble version' -- go.mod -- module dummy -go 1.22 +go 1.23 -- dummy.go -- package dummy diff --git a/testdata/script/implement.txtar b/testdata/script/implement.txtar index 8f0ff4f1..54b8e969 100644 --- a/testdata/script/implement.txtar +++ b/testdata/script/implement.txtar @@ -13,7 +13,7 @@ cmp stdout main.stdout -- go.mod -- module test/main -go 1.22 +go 1.23 -- main.go -- package main diff --git a/testdata/script/imports.txtar b/testdata/script/imports.txtar index d9ccc360..257275de 100644 --- a/testdata/script/imports.txtar +++ b/testdata/script/imports.txtar @@ -42,7 +42,7 @@ cmp stdout main.stdout -- go.mod -- module test/main -go 1.22 +go 1.23 require ( gopkg.in/garbletest.v2 v2.999.0 diff --git a/testdata/script/init.txtar b/testdata/script/init.txtar index 886b8fb9..d50923a9 100644 --- a/testdata/script/init.txtar +++ b/testdata/script/init.txtar @@ -12,7 +12,7 @@ cmp stderr main.stderr -- go.mod -- module test/main -go 1.22 +go 1.23 -- main.go -- package main diff --git a/testdata/script/ldflags.txtar b/testdata/script/ldflags.txtar index f4cec361..dd361bdf 100644 --- a/testdata/script/ldflags.txtar +++ b/testdata/script/ldflags.txtar @@ -28,7 +28,7 @@ binsubstr main$exe 'unexportedVersion' 'ExportedUnset' 'v1.22.33' 'garble_replac -- go.mod -- module domain.test/main -go 1.22 +go 1.23 -- main.go -- package main diff --git a/testdata/script/linker.txtar b/testdata/script/linker.txtar index 01857560..30f4d0b5 100644 --- a/testdata/script/linker.txtar +++ b/testdata/script/linker.txtar @@ -40,7 +40,7 @@ cmp stderr main.stderr -- go.mod -- module test/main -go 1.22 +go 1.23 -- main.go -- package main diff --git a/testdata/script/linkname.txtar b/testdata/script/linkname.txtar index 70f2d820..03c239a4 100644 --- a/testdata/script/linkname.txtar +++ b/testdata/script/linkname.txtar @@ -14,7 +14,7 @@ cmp stderr main.stderr -- go.mod -- module test/main -go 1.22 +go 1.23 replace big.chungus/meme => ./big.chungus/meme require big.chungus/meme v0.0.0 @@ -172,7 +172,7 @@ func ByteIndex(s string, c byte) int -- big.chungus/meme/go.mod -- module test/main -go 1.22 +go 1.23 -- big.chungus/meme/dante.go -- package meme diff --git a/testdata/script/list_error.txtar b/testdata/script/list_error.txtar index 91d922b7..9c7b1515 100644 --- a/testdata/script/list_error.txtar +++ b/testdata/script/list_error.txtar @@ -8,7 +8,7 @@ imports_missing${/}imports.go:5:8: package test/main/missing is not in std (${GO -- go.mod -- module test/main -go 1.22 +go 1.23 -- broken/broken.go -- package broken diff --git a/testdata/script/literals.txtar b/testdata/script/literals.txtar index e485a7a1..1a399d0d 100644 --- a/testdata/script/literals.txtar +++ b/testdata/script/literals.txtar @@ -59,7 +59,7 @@ exec garble -literals build std -- go.mod -- module test/main -go 1.22 +go 1.23 -- main.go -- package main diff --git a/testdata/script/modinfo.txtar b/testdata/script/modinfo.txtar index d0a1ec48..ebc4273f 100644 --- a/testdata/script/modinfo.txtar +++ b/testdata/script/modinfo.txtar @@ -26,7 +26,7 @@ stdout 'build\s*vcs.revision='${HEAD_COMMIT_SHA} -- go.mod -- module test/main -go 1.22 +go 1.23 -- main.go -- package main diff --git a/testdata/script/plugin.txtar b/testdata/script/plugin.txtar index a4e4aa5f..e0c9750c 100644 --- a/testdata/script/plugin.txtar +++ b/testdata/script/plugin.txtar @@ -26,7 +26,7 @@ cmp stderr main.stderr -- go.mod -- module test/main -go 1.22 +go 1.23 -- plugin/main.go -- package main diff --git a/testdata/script/position.txtar b/testdata/script/position.txtar index 0279c8e9..9bd145cc 100644 --- a/testdata/script/position.txtar +++ b/testdata/script/position.txtar @@ -16,7 +16,7 @@ stdout 'varPositions is sorted' -- go.mod -- module test/main -go 1.22 +go 1.23 -- garble_main.go -- package main diff --git a/testdata/script/reflect.txtar b/testdata/script/reflect.txtar index b5ff9e22..2c7e0f84 100644 --- a/testdata/script/reflect.txtar +++ b/testdata/script/reflect.txtar @@ -14,7 +14,7 @@ cmp stdout main.stdout -- go.mod -- module test/main -go 1.22 +go 1.23 -- garble_main.go -- package main diff --git a/testdata/script/reverse.txtar b/testdata/script/reverse.txtar index 1ade8764..ac90275d 100644 --- a/testdata/script/reverse.txtar +++ b/testdata/script/reverse.txtar @@ -46,7 +46,7 @@ cmp stdout main-literals.stderr -- go.mod -- module test/main -go 1.22 +go 1.23 -- long_main.go -- package main diff --git a/testdata/script/run.txtar b/testdata/script/run.txtar index 50e818c0..15db4d81 100644 --- a/testdata/script/run.txtar +++ b/testdata/script/run.txtar @@ -14,7 +14,7 @@ stdout 'garble_main\.go 9$' -- go.mod -- module test/main -go 1.22 +go 1.23 -- garble_main.go -- package main diff --git a/testdata/script/seed-cache.txtar b/testdata/script/seed-cache.txtar index 09a7e2e9..335aa11d 100644 --- a/testdata/script/seed-cache.txtar +++ b/testdata/script/seed-cache.txtar @@ -32,7 +32,7 @@ cd .. -- mod1/go.mod -- module test/main/mod1 -go 1.22 +go 1.23 require gopkg.in/garbletest.v2 v2.999.0 @@ -52,7 +52,7 @@ func main() { garbletest.Test() } -- mod2/go.mod -- module test/main/mod2 -go 1.22 +go 1.23 require gopkg.in/garbletest.v2 v2.999.0 diff --git a/testdata/script/seed.txtar b/testdata/script/seed.txtar index c447b1a9..6e9fcdd8 100644 --- a/testdata/script/seed.txtar +++ b/testdata/script/seed.txtar @@ -97,7 +97,7 @@ cmp stderr importedpkg.stderr -- go.mod -- module test/main -go 1.22 +go 1.23 -- main.go -- package main diff --git a/testdata/script/syntax.txtar b/testdata/script/syntax.txtar index c3117e54..eb5dc801 100644 --- a/testdata/script/syntax.txtar +++ b/testdata/script/syntax.txtar @@ -16,7 +16,7 @@ binsubstr main$exe 'globalVar' # 'globalType' matches on some, but not all, plat -- extra/go.mod -- module private.source/extra -go 1.22 +go 1.23 -- extra/extra.go -- package extra @@ -26,7 +26,7 @@ func Func() string { -- go.mod -- module test/main -go 1.22 +go 1.23 // We include an extra module to obfuscate, included in the same original source // code via a replace directive. diff --git a/testdata/script/test.txtar b/testdata/script/test.txtar index dea0fbd9..d104f7d7 100644 --- a/testdata/script/test.txtar +++ b/testdata/script/test.txtar @@ -52,7 +52,7 @@ stdout 'package bar_test, func name: test/bar\.OriginalFuncName' -- go.mod -- module test/bar -go 1.22 +go 1.23 -- bar.go -- package bar diff --git a/testdata/script/tiny.txtar b/testdata/script/tiny.txtar index 82ff9d32..91147466 100644 --- a/testdata/script/tiny.txtar +++ b/testdata/script/tiny.txtar @@ -27,7 +27,7 @@ stderr 'funcStructExported false funcStructUnexported false' -- go.mod -- module test/main -go 1.22 +go 1.23 -- garble_main.go -- package main diff --git a/testdata/script/typeparams.txtar b/testdata/script/typeparams.txtar index 1e803070..cb17824a 100644 --- a/testdata/script/typeparams.txtar +++ b/testdata/script/typeparams.txtar @@ -3,7 +3,7 @@ exec garble build -- go.mod -- module test/main -go 1.22 +go 1.23 -- garble_main.go -- package main