hashicorp / packer

Packer is a tool for creating identical machine images for multiple platforms from a single source configuration.
http://www.packer.io
Other
14.97k stars 3.33k forks source link

Go 1.22.0 toolchain introduces panic on go generate #13082

Open nywilken opened 2 days ago

nywilken commented 2 days ago
~>  go version
go version go1.22.4 darwin/amd64

~> make generate
==> removing autogenerated markdown...
find: website/pages: No such file or directory
==> removing autogenerated code...
PROJECT_ROOT="/Users/dev/Development/packer" go generate github.com/hashicorp/packer github.com/hashicorp/packer/acctest github.com/hashicorp/packer/acctest/plugin github.com/hashicorp/packer/builder/file github.com/hashicorp/packer/builder/file/version github.com/hashicorp/packer/builder/null github.com/hashicorp/packer/builder/null/version github.com/hashicorp/packer/cmd/generate-fixer-deprecations github.com/hashicorp/packer/cmd/ssh-keygen github.com/hashicorp/packer/command github.com/hashicorp/packer/command/enumflag github.com/hashicorp/packer/command/flag-kv github.com/hashicorp/packer/command/flag-slice github.com/hashicorp/packer/datasource/hcp-packer-artifact github.com/hashicorp/packer/datasource/hcp-packer-image github.com/hashicorp/packer/datasource/hcp-packer-iteration github.com/hashicorp/packer/datasource/hcp-packer-version github.com/hashicorp/packer/datasource/http github.com/hashicorp/packer/datasource/null github.com/hashicorp/packer/fix github.com/hashicorp/packer/hcl2template github.com/hashicorp/packer/hcl2template/addrs github.com/hashicorp/packer/hcl2template/function github.com/hashicorp/packer/hcl2template/internal github.com/hashicorp/packer/hcl2template/repl github.com/hashicorp/packer/hcl2template/shim github.com/hashicorp/packer/helper/wrappedreadline github.com/hashicorp/packer/helper/wrappedstreams github.com/hashicorp/packer/internal/hcp/api github.com/hashicorp/packer/internal/hcp/env github.com/hashicorp/packer/internal/hcp/registry github.com/hashicorp/packer/packer github.com/hashicorp/packer/packer/plugin-getter github.com/hashicorp/packer/packer/plugin-getter/github github.com/hashicorp/packer/packer_test github.com/hashicorp/packer/post-processor/artifice github.com/hashicorp/packer/post-processor/artifice/version github.com/hashicorp/packer/post-processor/checksum github.com/hashicorp/packer/post-processor/checksum/version github.com/hashicorp/packer/post-processor/compress github.com/hashicorp/packer/post-processor/compress/version github.com/hashicorp/packer/post-processor/manifest github.com/hashicorp/packer/post-processor/manifest/version github.com/hashicorp/packer/post-processor/shell-local github.com/hashicorp/packer/post-processor/shell-local/version github.com/hashicorp/packer/provisioner/breakpoint github.com/hashicorp/packer/provisioner/breakpoint/version github.com/hashicorp/packer/provisioner/file github.com/hashicorp/packer/provisioner/file/version github.com/hashicorp/packer/provisioner/powershell github.com/hashicorp/packer/provisioner/powershell/version github.com/hashicorp/packer/provisioner/shell github.com/hashicorp/packer/provisioner/shell/version github.com/hashicorp/packer/provisioner/shell-local github.com/hashicorp/packer/provisioner/shell-local/version github.com/hashicorp/packer/provisioner/sleep github.com/hashicorp/packer/provisioner/sleep/version github.com/hashicorp/packer/provisioner/windows-restart github.com/hashicorp/packer/provisioner/windows-restart/version github.com/hashicorp/packer/provisioner/windows-shell github.com/hashicorp/packer/provisioner/windows-shell/version github.com/hashicorp/packer/scripts github.com/hashicorp/packer/version
2024/06/28 10:03:46 Generated command/execute.go
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
    panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x7c0630f]

goroutine 497 [running]:
go/types.(*Checker).handleBailout(0xc0000caa00, 0xc000a13ca8)
    /usr/local/go/src/go/types/check.go:367 +0x88
panic({0x7cf28c0?, 0x7e7fc10?})
    /usr/local/go/src/runtime/panic.go:770 +0x132
go/types.(*StdSizes).Sizeof(0x0, {0x7d2e198, 0x7e82a40})
    /usr/local/go/src/go/types/sizes.go:228 +0x30f
go/types.(*Config).sizeof(...)
    /usr/local/go/src/go/types/sizes.go:333
go/types.representableConst.func1({0x7d2e198?, 0x7e82a40?})
    /usr/local/go/src/go/types/const.go:76 +0x9e
go/types.representableConst({0x7d2fc38, 0x7e785c0}, 0xc0000caa00, 0x7e82a40, 0xc000a120c0)
    /usr/local/go/src/go/types/const.go:92 +0x192
go/types.(*Checker).representation(0xc0000caa00, 0xc0001f2380, 0x7e82a40)
    /usr/local/go/src/go/types/const.go:256 +0x65
go/types.(*Checker).implicitTypeAndValue(0xc0000caa00, 0xc0001f2380, {0x7d2e198, 0x7e82a40})
    /usr/local/go/src/go/types/expr.go:375 +0x2d7
go/types.(*Checker).convertUntyped(0xc0000caa00, 0xc0001f2380, {0x7d2e198, 0x7e82a40})
    /usr/local/go/src/go/types/const.go:289 +0x3f
go/types.(*Checker).matchTypes(0xc0000caa00, 0xc0002c0100, 0xc0001f2380)
    /usr/local/go/src/go/types/expr.go:926 +0x79
go/types.(*Checker).binary(0xc0000caa00, 0xc0002c0100, {0x7d2f2c0, 0xc000e049c0}, {0x7d2ef30, 0xc001625d40}, {0x7d2f7d0, 0xc001625d60}, 0x28, 0x41deb)
    /usr/local/go/src/go/types/expr.go:800 +0x166
go/types.(*Checker).exprInternal(0xc0000caa00, 0x0, 0xc0002c0100, {0x7d2f2c0, 0xc000e049c0}, {0x0, 0x0})
    /usr/local/go/src/go/types/expr.go:1416 +0x206
go/types.(*Checker).rawExpr(0xc0000caa00, 0x0, 0xc0002c0100, {0x7d2f2c0?, 0xc000e049c0?}, {0x0?, 0x0?}, 0x0)
    /usr/local/go/src/go/types/expr.go:979 +0x19e
go/types.(*Checker).expr(0xc0000caa00, 0x7d2e940?, 0xc0002c0100, {0x7d2f2c0?, 0xc000e049c0?})
    /usr/local/go/src/go/types/expr.go:1513 +0x30
go/types.(*Checker).stmt(0xc0000caa00, 0x0, {0x7d2f620, 0xc00173d2c0})
    /usr/local/go/src/go/types/stmt.go:570 +0x11f2
go/types.(*Checker).stmtList(0xc0000caa00, 0x0, {0xc001625ec0?, 0x0?, 0x0?})
    /usr/local/go/src/go/types/stmt.go:121 +0x85
go/types.(*Checker).funcBody(0xc0000caa00, 0x7d2e198?, {0xc0018803d0?, 0x7e82c20?}, 0xc00173dd40, 0xc000e04a50, {0x0?, 0x0?})
    /usr/local/go/src/go/types/stmt.go:41 +0x331
go/types.(*Checker).funcDecl.func1()
    /usr/local/go/src/go/types/decl.go:852 +0x3a
go/types.(*Checker).processDelayed(0xc0000caa00, 0x0)
    /usr/local/go/src/go/types/check.go:467 +0x162
go/types.(*Checker).checkFiles(0xc0000caa00, {0xc000dbc000, 0x1, 0x1})
    /usr/local/go/src/go/types/check.go:411 +0x1cc
go/types.(*Checker).Files(...)
    /usr/local/go/src/go/types/check.go:372
golang.org/x/tools/go/packages.(*loader).loadPackage(0xc0000ac2c0, 0xc0004e78e0)
    /Users/dev/Development/go/pkg/mod/golang.org/x/tools@v0.0.0-20190525145741-7be61e1b0e51/go/packages/packages.go:825 +0x5c5
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1()
    /Users/dev/Development/go/pkg/mod/golang.org/x/tools@v0.0.0-20190525145741-7be61e1b0e51/go/packages/packages.go:683 +0x1a9
sync.(*Once).doSlow(0x0?, 0x0?)
    /usr/local/go/src/sync/once.go:74 +0xc2
sync.(*Once).Do(...)
    /usr/local/go/src/sync/once.go:65
golang.org/x/tools/go/packages.(*loader).loadRecursive(0x0?, 0x0?)
    /Users/dev/Development/go/pkg/mod/golang.org/x/tools@v0.0.0-20190525145741-7be61e1b0e51/go/packages/packages.go:670 +0x4a
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1.1(0x0?)
    /Users/dev/Development/go/pkg/mod/golang.org/x/tools@v0.0.0-20190525145741-7be61e1b0e51/go/packages/packages.go:677 +0x26
created by golang.org/x/tools/go/packages.(*loader).loadRecursive.func1 in goroutine 228
    /Users/dev/Development/go/pkg/mod/golang.org/x/tools@v0.0.0-20190525145741-7be61e1b0e51/go/packages/packages.go:676 +0x94
command/cli.go:15: running "enumer": exit status 2
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
    panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x436330f]

goroutine 82 [running]:
go/types.(*Checker).handleBailout(0xc0001c4200, 0xc00045fca8)
    /usr/local/go/src/go/types/check.go:367 +0x88
panic({0x444f8c0?, 0x45dcc10?})
    /usr/local/go/src/runtime/panic.go:770 +0x132
go/types.(*StdSizes).Sizeof(0x0, {0x448b198, 0x45dfa40})
    /usr/local/go/src/go/types/sizes.go:228 +0x30f
go/types.(*Config).sizeof(...)
    /usr/local/go/src/go/types/sizes.go:333
go/types.representableConst.func1({0x448b198?, 0x45dfa40?})
    /usr/local/go/src/go/types/const.go:76 +0x9e
go/types.representableConst({0x448cc38, 0x45d55c0}, 0xc0001c4200, 0x45dfa40, 0xc00045e0c0)
    /usr/local/go/src/go/types/const.go:92 +0x192
go/types.(*Checker).representation(0xc0001c4200, 0xc00034f380, 0x45dfa40)
    /usr/local/go/src/go/types/const.go:256 +0x65
go/types.(*Checker).implicitTypeAndValue(0xc0001c4200, 0xc00034f380, {0x448b198, 0x45dfa40})
    /usr/local/go/src/go/types/expr.go:375 +0x2d7
go/types.(*Checker).convertUntyped(0xc0001c4200, 0xc00034f380, {0x448b198, 0x45dfa40})
    /usr/local/go/src/go/types/const.go:289 +0x3f
go/types.(*Checker).matchTypes(0xc0001c4200, 0xc00034f340, 0xc00034f380)
    /usr/local/go/src/go/types/expr.go:926 +0x79
go/types.(*Checker).binary(0xc0001c4200, 0xc00034f340, {0x448c2c0, 0xc0009200c0}, {0x448bf30, 0xc000924100}, {0x448c7d0, 0xc000924120}, 0x28, 0x8f18)
    /usr/local/go/src/go/types/expr.go:800 +0x166
go/types.(*Checker).exprInternal(0xc0001c4200, 0x0, 0xc00034f340, {0x448c2c0, 0xc0009200c0}, {0x0, 0x0})
    /usr/local/go/src/go/types/expr.go:1416 +0x206
go/types.(*Checker).rawExpr(0xc0001c4200, 0x0, 0xc00034f340, {0x448c2c0?, 0xc0009200c0?}, {0x0?, 0x0?}, 0x0)
    /usr/local/go/src/go/types/expr.go:979 +0x19e
go/types.(*Checker).expr(0xc0001c4200, 0x448b940?, 0xc00034f340, {0x448c2c0?, 0xc0009200c0?})
    /usr/local/go/src/go/types/expr.go:1513 +0x30
go/types.(*Checker).stmt(0xc0001c4200, 0x0, {0x448c620, 0xc00093a100})
    /usr/local/go/src/go/types/stmt.go:570 +0x11f2
go/types.(*Checker).stmtList(0xc0001c4200, 0x0, {0xc000924280?, 0x0?, 0x0?})
    /usr/local/go/src/go/types/stmt.go:121 +0x85
go/types.(*Checker).funcBody(0xc0001c4200, 0x448b198?, {0xc00090a050?, 0x45dfc20?}, 0xc00034f000, 0xc000920150, {0x0?, 0x0?})
    /usr/local/go/src/go/types/stmt.go:41 +0x331
go/types.(*Checker).funcDecl.func1()
    /usr/local/go/src/go/types/decl.go:852 +0x3a
go/types.(*Checker).processDelayed(0xc0001c4200, 0x0)
    /usr/local/go/src/go/types/check.go:467 +0x162
go/types.(*Checker).checkFiles(0xc0001c4200, {0xc00091e000, 0x1, 0x1})
    /usr/local/go/src/go/types/check.go:411 +0x1cc
go/types.(*Checker).Files(...)
    /usr/local/go/src/go/types/check.go:372
golang.org/x/tools/go/packages.(*loader).loadPackage(0xc0002242c0, 0xc000299e20)
    /Users/dev/Development/go/pkg/mod/golang.org/x/tools@v0.0.0-20190525145741-7be61e1b0e51/go/packages/packages.go:825 +0x5c5
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1()
    /Users/dev/Development/go/pkg/mod/golang.org/x/tools@v0.0.0-20190525145741-7be61e1b0e51/go/packages/packages.go:683 +0x1a9
sync.(*Once).doSlow(0x0?, 0x0?)
    /usr/local/go/src/sync/once.go:74 +0xc2
sync.(*Once).Do(...)
    /usr/local/go/src/sync/once.go:65
golang.org/x/tools/go/packages.(*loader).loadRecursive(0x0?, 0x0?)
    /Users/dev/Development/go/pkg/mod/golang.org/x/tools@v0.0.0-20190525145741-7be61e1b0e51/go/packages/packages.go:670 +0x4a
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1.1(0x0?)
    /Users/dev/Development/go/pkg/mod/golang.org/x/tools@v0.0.0-20190525145741-7be61e1b0e51/go/packages/packages.go:677 +0x26
created by golang.org/x/tools/go/packages.(*loader).loadRecursive.func1 in goroutine 8
    /Users/dev/Development/go/pkg/mod/golang.org/x/tools@v0.0.0-20190525145741-7be61e1b0e51/go/packages/packages.go:676 +0x94
packer/run_interfaces.go:65: running "enumer": exit status 2
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
    panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x6a5730f]

goroutine 239 [running]:
go/types.(*Checker).handleBailout(0xc000120400, 0xc00060fca8)
    /usr/local/go/src/go/types/check.go:367 +0x88
panic({0x6b438c0?, 0x6cd0c10?})
    /usr/local/go/src/runtime/panic.go:770 +0x132
go/types.(*StdSizes).Sizeof(0x0, {0x6b7f198, 0x6cd3a40})
    /usr/local/go/src/go/types/sizes.go:228 +0x30f
go/types.(*Config).sizeof(...)
    /usr/local/go/src/go/types/sizes.go:333
go/types.representableConst.func1({0x6b7f198?, 0x6cd3a40?})
    /usr/local/go/src/go/types/const.go:76 +0x9e
go/types.representableConst({0x6b80c38, 0x6cc95c0}, 0xc000120400, 0x6cd3a40, 0xc00060e0c0)
    /usr/local/go/src/go/types/const.go:92 +0x192
go/types.(*Checker).representation(0xc000120400, 0xc0001cfc00, 0x6cd3a40)
    /usr/local/go/src/go/types/const.go:256 +0x65
go/types.(*Checker).implicitTypeAndValue(0xc000120400, 0xc0001cfc00, {0x6b7f198, 0x6cd3a40})
    /usr/local/go/src/go/types/expr.go:375 +0x2d7
go/types.(*Checker).convertUntyped(0xc000120400, 0xc0001cfc00, {0x6b7f198, 0x6cd3a40})
    /usr/local/go/src/go/types/const.go:289 +0x3f
go/types.(*Checker).matchTypes(0xc000120400, 0xc0001cfbc0, 0xc0001cfc00)
    /usr/local/go/src/go/types/expr.go:926 +0x79
go/types.(*Checker).binary(0xc000120400, 0xc0001cfbc0, {0x6b802c0, 0xc0001ec0c0}, {0x6b7ff30, 0xc000888100}, {0x6b807d0, 0xc000888120}, 0x28, 0x2ffe)
    /usr/local/go/src/go/types/expr.go:800 +0x166
go/types.(*Checker).exprInternal(0xc000120400, 0x0, 0xc0001cfbc0, {0x6b802c0, 0xc0001ec0c0}, {0x0, 0x0})
    /usr/local/go/src/go/types/expr.go:1416 +0x206
go/types.(*Checker).rawExpr(0xc000120400, 0x0, 0xc0001cfbc0, {0x6b802c0?, 0xc0001ec0c0?}, {0x0?, 0x0?}, 0x0)
    /usr/local/go/src/go/types/expr.go:979 +0x19e
go/types.(*Checker).expr(0xc000120400, 0x6b7f940?, 0xc0001cfbc0, {0x6b802c0?, 0xc0001ec0c0?})
    /usr/local/go/src/go/types/expr.go:1513 +0x30
go/types.(*Checker).stmt(0xc000120400, 0x0, {0x6b80620, 0xc00088a100})
    /usr/local/go/src/go/types/stmt.go:570 +0x11f2
go/types.(*Checker).stmtList(0xc000120400, 0x0, {0xc0008882c0?, 0x0?, 0x0?})
    /usr/local/go/src/go/types/stmt.go:121 +0x85
go/types.(*Checker).funcBody(0xc000120400, 0x6b7f198?, {0xc000e140a8?, 0x6cd3c20?}, 0xc0001cf880, 0xc0001ec150, {0x0?, 0x0?})
    /usr/local/go/src/go/types/stmt.go:41 +0x331
go/types.(*Checker).funcDecl.func1()
    /usr/local/go/src/go/types/decl.go:852 +0x3a
go/types.(*Checker).processDelayed(0xc000120400, 0x0)
    /usr/local/go/src/go/types/check.go:467 +0x162
go/types.(*Checker).checkFiles(0xc000120400, {0xc0001c2000, 0x1, 0x1})
    /usr/local/go/src/go/types/check.go:411 +0x1cc
go/types.(*Checker).Files(...)
    /usr/local/go/src/go/types/check.go:372
golang.org/x/tools/go/packages.(*loader).loadPackage(0xc0000ac2c0, 0xc0002564e0)
    /Users/dev/Development/go/pkg/mod/golang.org/x/tools@v0.0.0-20190525145741-7be61e1b0e51/go/packages/packages.go:825 +0x5c5
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1()
    /Users/dev/Development/go/pkg/mod/golang.org/x/tools@v0.0.0-20190525145741-7be61e1b0e51/go/packages/packages.go:683 +0x1a9
sync.(*Once).doSlow(0x0?, 0x0?)
    /usr/local/go/src/sync/once.go:74 +0xc2
sync.(*Once).Do(...)
    /usr/local/go/src/sync/once.go:65
golang.org/x/tools/go/packages.(*loader).loadRecursive(0x0?, 0x0?)
    /Users/dev/Development/go/pkg/mod/golang.org/x/tools@v0.0.0-20190525145741-7be61e1b0e51/go/packages/packages.go:670 +0x4a
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1.1(0x0?)
    /Users/dev/Development/go/pkg/mod/golang.org/x/tools@v0.0.0-20190525145741-7be61e1b0e51/go/packages/packages.go:677 +0x26
created by golang.org/x/tools/go/packages.(*loader).loadRecursive.func1 in goroutine 231
    /Users/dev/Development/go/pkg/mod/golang.org/x/tools@v0.0.0-20190525145741-7be61e1b0e51/go/packages/packages.go:676 +0x94
provisioner/powershell/execution_policy.go:4: running "enumer": exit status 2
make: *** [generate] Error 1
nywilken commented 2 days ago

Pinning toolchain to go1.21.11 works as expected.

~>  go version
go version go1.22.4 darwin/amd64
~> GOTOOLCHAIN=go1.21.11 make generate
go: downloading go1.21.11 (darwin/amd64)
==> removing autogenerated markdown...
find: website/pages: No such file or directory
==> removing autogenerated code...
PROJECT_ROOT="/Users/wilken/Development/packer" go generate github.com/hashicorp/packer github.com/hashicorp/packer/acctest github.com/hashicorp/packer/acctest/plugin github.com/hashicorp/packer/builder/file github.com/hashicorp/packer/builder/file/version github.com/hashicorp/packer/builder/null github.com/hashicorp/packer/builder/null/version github.com/hashicorp/packer/cmd/generate-fixer-deprecations github.com/hashicorp/packer/cmd/ssh-keygen github.com/hashicorp/packer/command github.com/hashicorp/packer/command/enumflag github.com/hashicorp/packer/command/flag-kv github.com/hashicorp/packer/command/flag-slice github.com/hashicorp/packer/datasource/hcp-packer-artifact github.com/hashicorp/packer/datasource/hcp-packer-image github.com/hashicorp/packer/datasource/hcp-packer-iteration github.com/hashicorp/packer/datasource/hcp-packer-version github.com/hashicorp/packer/datasource/http github.com/hashicorp/packer/datasource/null github.com/hashicorp/packer/fix github.com/hashicorp/packer/hcl2template github.com/hashicorp/packer/hcl2template/addrs github.com/hashicorp/packer/hcl2template/function github.com/hashicorp/packer/hcl2template/internal github.com/hashicorp/packer/hcl2template/repl github.com/hashicorp/packer/hcl2template/shim github.com/hashicorp/packer/helper/wrappedreadline github.com/hashicorp/packer/helper/wrappedstreams github.com/hashicorp/packer/internal/hcp/api github.com/hashicorp/packer/internal/hcp/env github.com/hashicorp/packer/internal/hcp/registry github.com/hashicorp/packer/packer github.com/hashicorp/packer/packer/plugin-getter github.com/hashicorp/packer/packer/plugin-getter/github github.com/hashicorp/packer/packer_test github.com/hashicorp/packer/post-processor/artifice github.com/hashicorp/packer/post-processor/artifice/version github.com/hashicorp/packer/post-processor/checksum github.com/hashicorp/packer/post-processor/checksum/version github.com/hashicorp/packer/post-processor/compress github.com/hashicorp/packer/post-processor/compress/version github.com/hashicorp/packer/post-processor/manifest github.com/hashicorp/packer/post-processor/manifest/version github.com/hashicorp/packer/post-processor/shell-local github.com/hashicorp/packer/post-processor/shell-local/version github.com/hashicorp/packer/provisioner/breakpoint github.com/hashicorp/packer/provisioner/breakpoint/version github.com/hashicorp/packer/provisioner/file github.com/hashicorp/packer/provisioner/file/version github.com/hashicorp/packer/provisioner/powershell github.com/hashicorp/packer/provisioner/powershell/version github.com/hashicorp/packer/provisioner/shell github.com/hashicorp/packer/provisioner/shell/version github.com/hashicorp/packer/provisioner/shell-local github.com/hashicorp/packer/provisioner/shell-local/version github.com/hashicorp/packer/provisioner/sleep github.com/hashicorp/packer/provisioner/sleep/version github.com/hashicorp/packer/provisioner/windows-restart github.com/hashicorp/packer/provisioner/windows-restart/version github.com/hashicorp/packer/provisioner/windows-shell github.com/hashicorp/packer/provisioner/windows-shell/version github.com/hashicorp/packer/scripts github.com/hashicorp/packer/version
2024/06/28 10:14:11 Generated command/execute.go