bflad / tfproviderlint

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

update x/tools #256

Closed remyleone closed 1 year ago

bflad commented 2 years ago

@remyleone can you ensure that all the files from go mod vendor are added as well? Thanks!

bflad commented 2 years ago

Very strange:

--- FAIL: TestAnalyzerFixes (1.19s)
Error:     analysistest.go:229: /home/runner/work/tfproviderlint/tfproviderlint/xpasses/XR007/testdata/src/a/alias.go: error formatting resulting source: 9:6: expected '(', found fAlias (and 1 more errors)
        package a

        import (
            e "os/exec"
        )

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

        func fAlias() {
             // want "avoid os/exec.Command"

            failingAlias("true")
        }

https://github.com/bflad/tfproviderlint/blob/9717018be82635e82809d1f68179793bfe088e12/xpasses/XR007/testdata/src/a/alias.go

package a

import (
    e "os/exec"
)

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

func fAlias() {
    e.Command("true") // want "avoid os/exec.Command"

    failingAlias("true")
}

Maybe switching those files to this syntax will fix them as a quick fix for whatever is going on differently in x/tools:

var (
  // ... 
)
mattburgess commented 2 years ago

If it helps any, I bisected those test failures down to golang.org/x/tools v0.1.8. Using v0.1.7, they pass just fine. Interestingly, and maybe related, it's v0.1.8 that fixes the original issue this was intended to fix, namely #255 which I happen to be hitting trying to run make providerlint on the AWS provider.

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.