Skip to content

Commit

Permalink
github actions: Upgrade from go1.17 to 1.18; workaround bugs
Browse files Browse the repository at this point in the history
The go toolchain currently has a regression with very deep static call
graph. Work around with -gcflags -G=0.

The currently released version of staticcheck is not yet compatible with
go1.18. Pin an unreleased version.
  • Loading branch information
maruel committed Mar 19, 2022
1 parent 426572b commit 1e7f767
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/test.yml
Expand Up @@ -24,7 +24,7 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
# Do not forget to bump every 6 months!
gover: ["1.17"]
gover: ["1.18"]
runs-on: "${{matrix.os}}"
name: "go${{matrix.gover}}.x on ${{matrix.os}}"
env:
Expand Down Expand Up @@ -111,7 +111,9 @@ jobs:
go install github.com/securego/gosec/cmd/gosec@latest
go install golang.org/x/lint/golint@latest
go install golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow@latest
go install honnef.co/go/tools/cmd/staticcheck@latest
# Replace once staticcheck has a released version compatible with go1.18
#go install honnef.co/go/tools/cmd/staticcheck@latest
go install honnef.co/go/tools/cmd/staticcheck@23e1086441d24fed9f668ad1cd4374245118b590
- name: 'go get necessary tools (ubuntu)'
if: always() && matrix.os == 'ubuntu-latest'
run: |
Expand Down
2 changes: 1 addition & 1 deletion internal/internaltest/internaltest.go
Expand Up @@ -205,7 +205,7 @@ func Compile(in, exe, cwd string, disableInlining, race bool) error {
// Elided being true without any argument.
args := []string{"build", "-o", exe}
if disableInlining {
args = append(args, "-gcflags", "-N -l")
args = append(args, "-gcflags", "-N -l -G=0")
}
if race {
args = append(args, "-race")
Expand Down
4 changes: 2 additions & 2 deletions stack/context_test.go
Expand Up @@ -2017,9 +2017,9 @@ func testPanicUTF8(t *testing.T, s *Snapshot, b *bytes.Buffer, ppDir string) {
// not.
"github.com/maruel/panicparse"+ver+"/cmd/panic/internal/utf8.(*Strùct).Pànic",
ifCombinedAggregateArgs(
Args{Values: []Arg{{Value: 1}}},
Args{Values: []Arg{{Value: 1, IsInaccurate: true}}},
// else
Args{Values: []Arg{{Value: 0xc0000b2e48, IsPtr: true}}},
Args{Values: []Arg{{Value: 0xc0000b2e48, IsPtr: true, IsInaccurate: true}}},
),
// See TestCallUTF8 in stack_test.go for exercising the methods on
// Call in this situation.
Expand Down
2 changes: 1 addition & 1 deletion stack/example_test.go
Expand Up @@ -49,7 +49,7 @@ func Example_text() {
p := filepath.Join(root, "main.go")
ioutil.WriteFile(p, []byte(source), 0600)
// Disable both optimization (-N) and inlining (-l).
c := exec.Command("go", "run", "-gcflags", "-N -l", p)
c := exec.Command("go", "run", "-gcflags", "-N -l -G=0", p)
// This is important, otherwise only the panicking goroutine will be printed.
c.Env = append(os.Environ(), "GOTRACEBACK=1")
raw, _ := c.CombinedOutput()
Expand Down
2 changes: 1 addition & 1 deletion stack/source_test.go
Expand Up @@ -1675,7 +1675,7 @@ func getCrash(t *testing.T, main string, disableInline bool) []byte {
args := []string{"run"}
if disableInline {
// Disable both optimization (-N) and inlining (-l).
args = append(args, "-gcflags", "-N -l")
args = append(args, "-gcflags", "-N -l -G=0")
}
cmd := exec.Command("go", append(args, main)...)
// Use the Go 1.4 compatible format.
Expand Down

0 comments on commit 1e7f767

Please sign in to comment.