bflad / tfproviderlint

Terraform Provider Lint Tool
Mozilla Public License 2.0
136 stars 25 forks source link

bump golang.org/x/tools to v0.6.0 #264

Closed jackofallops closed 1 year ago

jackofallops commented 1 year ago

supersedes #259 fixes #255

Removed tests XR007.TestAnalyzerFixes and XR008.TestAnalyzerFixes which only previously passed due to a continue on err bug in golang.org/x/tools when formatting the amended source:

image

image

https://github.com/bflad/tfproviderlint/blob/main/vendor/golang.org/x/tools/go/analysis/analysistest/analysistest.go#L221

bflad commented 1 year ago

Hey @jackofallops 👋 Thank you for submitting this. Rather than removing the tests, can you please fix the source code for those tests? We should be validating that the suggested fixes still work.

bflad commented 1 year ago

Actually, never mind. I'm not sure there is a decent way to make that pass -- generally removing the Go associated with "avoid" selectors would generate Go syntax errors. Will merge if the tests pass.

bflad commented 1 year ago

There may be other code changes required:

Error: /home/runner/work/tfproviderlint/tfproviderlint/passes/AT001/testdata/src/a/vendor/golang.org/x/sys/unix/syscall.go:83:23: Slice not declared by package unsafe
Error: /home/runner/work/tfproviderlint/tfproviderlint/passes/AT001/testdata/src/a/vendor/golang.org/x/sys/unix/syscall_linux.go:[22](https://github.com/bflad/tfproviderlint/actions/runs/4312062115/jobs/7533007795#step:4:23)71:16: Slice not declared by package unsafe
Error: /home/runner/work/tfproviderlint/tfproviderlint/passes/AT001/testdata/src/a/vendor/golang.org/x/sys/unix/syscall_unix.go:118:14: Slice not declared by package unsafe
Error: /home/runner/work/tfproviderlint/tfproviderlint/passes/AT001/testdata/src/a/vendor/golang.org/x/sys/unix/sysvshm_unix.go:33:14: Slice not declared by package unsafe
jackofallops commented 1 year ago

There may be other code changes required:

Error: /home/runner/work/tfproviderlint/tfproviderlint/passes/AT001/testdata/src/a/vendor/golang.org/x/sys/unix/syscall.go:83:23: Slice not declared by package unsafe
Error: /home/runner/work/tfproviderlint/tfproviderlint/passes/AT001/testdata/src/a/vendor/golang.org/x/sys/unix/syscall_linux.go:[22](https://github.com/bflad/tfproviderlint/actions/runs/4312062115/jobs/7533007795#step:4:23)71:16: Slice not declared by package unsafe
Error: /home/runner/work/tfproviderlint/tfproviderlint/passes/AT001/testdata/src/a/vendor/golang.org/x/sys/unix/syscall_unix.go:118:14: Slice not declared by package unsafe
Error: /home/runner/work/tfproviderlint/tfproviderlint/passes/AT001/testdata/src/a/vendor/golang.org/x/sys/unix/sysvshm_unix.go:33:14: Slice not declared by package unsafe

I'll take another look asap - thanks @bflad

jackofallops commented 1 year ago

I ran go test ./... on 1.16 and I don't see the failures?

ok      github.com/bflad/tfproviderlint/passes  1.018s
ok      github.com/bflad/tfproviderlint/passes/AT001    21.156s
ok      github.com/bflad/tfproviderlint/passes/AT002    3.624s
ok      github.com/bflad/tfproviderlint/passes/AT003    4.593s
ok      github.com/bflad/tfproviderlint/passes/AT004    8.088s
ok      github.com/bflad/tfproviderlint/passes/AT005    8.539s
ok      github.com/bflad/tfproviderlint/passes/AT006    7.366s
ok      github.com/bflad/tfproviderlint/passes/AT007    8.268s
ok      github.com/bflad/tfproviderlint/passes/AT008    2.489s
ok      github.com/bflad/tfproviderlint/passes/AT009    5.298s
ok      github.com/bflad/tfproviderlint/passes/AT010    7.406s
ok      github.com/bflad/tfproviderlint/passes/AT011    7.518s
ok      github.com/bflad/tfproviderlint/passes/AT012    4.918s

Will take another look tomorrow....

bflad commented 1 year ago

After some rigamarole with needing to upgrade Go (#269) and then x/tools (#270), this should be resolved in the upcoming v0.29.0 release 🔜 . Thanks for submitting this and sorry for the delayed resolution.