Closed remyleone closed 3 months ago
Will add more detail when the provider I'm working on becomes public; for now, I can confirm that this is an issue only impacting some providers. This issue was encountered only after implementing a new data source with a Schema as:
func (d *listDataSource) Schema(_ context.Context, _ tfds.SchemaRequest, resp *tfds.SchemaResponse) {
resp.Schema = dschema.Schema{
MarkdownDescription: listDataSourceMarkdownDescription,
Attributes: map[string]dschema.Attribute{
"plans": dschema.ListNestedAttribute{
MarkdownDescription: dataSourceMarkdownDescription,
Computed: true,
NestedObject: dschema.NestedAttributeObject{
Attributes: schemaAttributes(),
},
},
},
}
}
Prior to adding this provider, and the rest of its implementation, I only had implemented a few simple providers which ran the linter with no problems!
Thank you for the reports and sorry for the trouble. This tooling is dependent on Go static analysis tooling APIs without the same compatibility as the language itself, so this sort of issue can occur when the Go language is updated. For better or worse, it looks like this is also reproducible with the Go module's unit testing, e.g.
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=0x2 addr=0x0 pc=0x100ab0874]
goroutine 261 [running]:
go/types.(*Checker).handleBailout(0x14000932600, 0x14000285b98)
/opt/homebrew/Cellar/go/1.22.3/libexec/src/go/types/check.go:367 +0x9c
panic({0x100bc9e60?, 0x100da0670?})
/opt/homebrew/Cellar/go/1.22.3/libexec/src/runtime/panic.go:770 +0x124
go/types.(*StdSizes).Sizeof(0x0, {0x100c16a78, 0x100da3aa0})
/opt/homebrew/Cellar/go/1.22.3/libexec/src/go/types/sizes.go:228 +0x314
go/types.(*Config).sizeof(...)
/opt/homebrew/Cellar/go/1.22.3/libexec/src/go/types/sizes.go:333
go/types.representableConst.func1({0x100c16a78?, 0x100da3aa0?})
/opt/homebrew/Cellar/go/1.22.3/libexec/src/go/types/const.go:76 +0x9c
go/types.representableConst({0x100c17dc0, 0x100d97d78}, 0x14000932600, 0x100da3aa0, 0x14000283c78)
/opt/homebrew/Cellar/go/1.22.3/libexec/src/go/types/const.go:106 +0x2b0
go/types.(*Checker).representation(0x14000932600, 0x14000569dc0, 0x100da3aa0)
/opt/homebrew/Cellar/go/1.22.3/libexec/src/go/types/const.go:256 +0x68
go/types.(*Checker).representable(0x14000932600, 0x14000569dc0, 0x100da3aa0)
/opt/homebrew/Cellar/go/1.22.3/libexec/src/go/types/const.go:239 +0x28
go/types.(*Checker).shift(0x14000932600, 0x14000569d40, 0x14000569dc0, {0x100c172b8, 0x140007554d0}, 0x14)
/opt/homebrew/Cellar/go/1.22.3/libexec/src/go/types/expr.go:650 +0x1d8
go/types.(*Checker).binary(0x14000932600, 0x14000569d40, {0x100c172b8, 0x140007554d0}, {0x100c16e08, 0x140000ed500}, {0x100c16e08, 0x140000ed520}, 0x14, 0x9ce)
/opt/homebrew/Cellar/go/1.22.3/libexec/src/go/types/expr.go:796 +0x100
go/types.(*Checker).exprInternal(0x14000932600, 0x0, 0x14000569d40, {0x100c172b8, 0x140007554d0}, {0x0, 0x0})
/opt/homebrew/Cellar/go/1.22.3/libexec/src/go/types/expr.go:1416 +0x1d4
go/types.(*Checker).rawExpr(0x14000932600, 0x0, 0x14000569d40, {0x100c172b8?, 0x140007554d0?}, {0x0?, 0x0?}, 0x0)
/opt/homebrew/Cellar/go/1.22.3/libexec/src/go/types/expr.go:979 +0x12c
go/types.(*Checker).expr(0x14000932600, 0x0?, 0x14000569d40, {0x100c172b8?, 0x140007554d0?})
/opt/homebrew/Cellar/go/1.22.3/libexec/src/go/types/expr.go:1513 +0x38
go/types.(*Checker).binary(0x14000932600, 0x14000569d40, {0x100c172b8, 0x14000755500}, {0x100c172b8, 0x140007554d0}, {0x100c16e08, 0x140000ed540}, 0xd, 0x9d2)
/opt/homebrew/Cellar/go/1.22.3/libexec/src/go/types/expr.go:783 +0x70
go/types.(*Checker).exprInternal(0x14000932600, 0x0, 0x14000569d40, {0x100c172b8, 0x14000755500}, {0x0, 0x0})
/opt/homebrew/Cellar/go/1.22.3/libexec/src/go/types/expr.go:1416 +0x1d4
go/types.(*Checker).rawExpr(0x14000932600, 0x0, 0x14000569d40, {0x100c172b8?, 0x14000755500?}, {0x0?, 0x0?}, 0x0)
/opt/homebrew/Cellar/go/1.22.3/libexec/src/go/types/expr.go:979 +0x12c
go/types.(*Checker).expr(0x14000932600, 0x14000b3fb60?, 0x14000569d40, {0x100c172b8?, 0x14000755500?})
/opt/homebrew/Cellar/go/1.22.3/libexec/src/go/types/expr.go:1513 +0x38
go/types.(*Checker).constDecl(0x14000932600, 0x14000b3fc20, {0x0, 0x0}, {0x100c172b8, 0x14000755500}, 0x0)
/opt/homebrew/Cellar/go/1.22.3/libexec/src/go/types/decl.go:488 +0x23c
go/types.(*Checker).objDecl(0x14000932600, {0x100c1a118, 0x14000b3fc20}, 0x0)
/opt/homebrew/Cellar/go/1.22.3/libexec/src/go/types/decl.go:191 +0x84c
go/types.(*Checker).packageObjects(0x14000932600)
/opt/homebrew/Cellar/go/1.22.3/libexec/src/go/types/resolver.go:693 +0x468
go/types.(*Checker).checkFiles(0x14000932600, {0x140001126a0, 0x1, 0x1})
/opt/homebrew/Cellar/go/1.22.3/libexec/src/go/types/check.go:408 +0x164
go/types.(*Checker).Files(...)
/opt/homebrew/Cellar/go/1.22.3/libexec/src/go/types/check.go:372
golang.org/x/tools/go/packages.(*loader).loadPackage(0x140001881c0, 0x14000715a70)
/Users/bflad/src/github.com/bflad/tfproviderlint/vendor/golang.org/x/tools/go/packages/packages.go:1055 +0x870
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1()
/Users/bflad/src/github.com/bflad/tfproviderlint/vendor/golang.org/x/tools/go/packages/packages.go:854 +0x178
sync.(*Once).doSlow(0x0?, 0x0?)
/opt/homebrew/Cellar/go/1.22.3/libexec/src/sync/once.go:74 +0x100
sync.(*Once).Do(...)
/opt/homebrew/Cellar/go/1.22.3/libexec/src/sync/once.go:65
golang.org/x/tools/go/packages.(*loader).loadRecursive(0x0?, 0x0?)
/Users/bflad/src/github.com/bflad/tfproviderlint/vendor/golang.org/x/tools/go/packages/packages.go:842 +0x50
golang.org/x/tools/go/packages.(*loader).loadRecursive.func1.1(0x0?)
/Users/bflad/src/github.com/bflad/tfproviderlint/vendor/golang.org/x/tools/go/packages/packages.go:849 +0x30
created by golang.org/x/tools/go/packages.(*loader).loadRecursive.func1 in goroutine 254
/Users/bflad/src/github.com/bflad/tfproviderlint/vendor/golang.org/x/tools/go/packages/packages.go:848 +0x84
FAIL github.com/bflad/tfproviderlint/passes/AT001 2.654s
I will take a look today to see how difficult it might be to upgrade those tooling dependences so this Go module can support Go 1.22.
@remyleone thank you for providing the affected repository and command you ran -- after #299, was able to confirm that upgrading golang.org/x/tools to latest seems to have resolved this issue.
terraform-provider-scaleway on master via 🦫 v1.22.3
❯ ~/go/bin/tfproviderlint -R014=false -AT001.ignored-filename-suffixes=_data_source_test.go ./...
terraform-provider-scaleway on master via 🦫 v1.22.3 took 15s
❯
Will cut a tfproviderlint v0.30.0 release soon after I take care of some other dependency and GitHub Actions workflow upgrades.
https://github.com/scaleway/terraform-provider-scaleway/actions/runs/8722750320/job/23929321814?pr=2540