bflad / tfproviderlint

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

Bump go x tools to v0.2.0 #260

Closed Codelax closed 1 year ago

Codelax commented 2 years ago

I updated golang.org/x/tools to v0.2.0

I also changed broken tests to use variable assignation instead of variable declaration. Using variable declaration in tests will fails as the code output will fail with gofmt and analysistest.RunWithSuggestedFixes expect edited code to be able to run under gofmt.

Old test would do

var failingAlias =  e.Command // want "avoid os/exec.Command"

to

var failingAlias =  // want "avoid os/exec.Command"

This will also fail with the bulk version

var (
    failingAlias =  // want "avoid os/exec.Command"
)

If you prefer i could change XR007 and XR008 to edit assignments and variables declaration containing the selectionExpr. It would work like this

var (
    failingAlias =  e.Command // want "avoid os/exec.Command"
)

to

var (
    // want "avoid os/exec.Command"
)
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.