Skip to content

Commit

Permalink
fix garble with newer Go tip versions
Browse files Browse the repository at this point in the history
Some big changes landed in Go for the upcoming 1.20.

While here, remove the use of GOGC=off with make.bash,
as https://go.dev/cl/436235 makes that unnecessary now.
  • Loading branch information
mvdan committed Nov 12, 2022
1 parent ff52178 commit e61317e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
steps:
- name: Install Go
env:
GO_COMMIT: 5f566d35bf7d590c95f4d1b685b995deeb9ba957 # 2022-10-01
GO_COMMIT: 122a22e0e9eba7fe712030d429fc4bcf6f447f5e # 2022-11-12
run: |
cd $HOME
mkdir $HOME/gotip
Expand All @@ -89,8 +89,7 @@ jobs:
echo "devel go1.20-${GO_COMMIT}" >VERSION
cd src
# GOGC=off helps Go build about 20% faster, if we can spare memory.
GOGC=off ./make.bash
./make.bash
echo "GOROOT=$HOME/gotip" >>$GITHUB_ENV
echo "$HOME/gotip/bin" >>$GITHUB_PATH
- uses: actions/checkout@v3
Expand Down
6 changes: 5 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -729,8 +729,12 @@ func replaceAsmNames(buf *bytes.Buffer, remaining []byte) {

// If the name was qualified, fetch the package, and write the
// obfuscated import path if needed.
// Note that runtime/internal/startlinetest refers to runtime_test in
// one of its assembly files, and we currently do not always collect
// test packages in appendListedPackages for the sake of performance.
// We don't care about testing the runtime just yet, so work around it.
lpkg := curPkg
if asmPkgPath != "" {
if asmPkgPath != "" && asmPkgPath != "runtime_test" {
var err error
lpkg, err = listPackage(goPkgPath)
if err != nil {
Expand Down
6 changes: 5 additions & 1 deletion shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,14 +336,18 @@ func listPackage(path string) (*listedPackage, error) {
panic(fmt.Sprintf("package %q still missing after go list call", path))
}
startTime := time.Now()
// Obtained via scripts/runtime-linknamed-nodeps.sh as of 2022-10-01.
// Obtained via scripts/runtime-linknamed-nodeps.sh as of 2022-11-01.
runtimeLinknamed := []string{
"arena",
"crypto/internal/boring",
"crypto/internal/boring/bcache",
"crypto/internal/boring/fipstls",
"crypto/x509/internal/macos",
"internal/godebug",
"internal/poll",
"internal/reflectlite",
"internal/syscall/unix",
"math/rand",
"net",
"os",
"os/signal",
Expand Down
10 changes: 8 additions & 2 deletions testdata/script/reverse.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ cp stderr build-error.stderr

stdin build-error.stderr
garble reverse ./build-error
cmp stdout build-error-reverse.stdout
[!go1.20] cmp stdout build-error-reverse.stdout-go1.19
[go1.20] cmp stdout build-error-reverse.stdout-go1.20

[short] stop # no need to verify this with -short

Expand Down Expand Up @@ -158,8 +159,13 @@ main.main(...)
test/main/long_main.go:11 +0x??

main filename: test/main/long_main.go
-- build-error-reverse.stdout --
-- build-error-reverse.stdout-go1.19 --
# test/main/build-error
test/main/build-error/error.go:18: cannot convert UnobfuscatedStruct{} (value of type UnobfuscatedStruct) to type struct{SomeField int}
exit status 2
exit status 2
-- build-error-reverse.stdout-go1.20 --
go build test/main/build-error: # test/main/build-error
test/main/build-error/error.go:18: cannot convert UnobfuscatedStruct{} (value of type UnobfuscatedStruct) to type struct{SomeField int}
exit status 2
exit status 1

0 comments on commit e61317e

Please sign in to comment.