From fa8056ce94248bf396295c0b208553f655782e91 Mon Sep 17 00:00:00 2001 From: Austin Valle Date: Thu, 26 Jan 2023 14:24:42 -0500 Subject: [PATCH] ci: add `golangci-lint` + fix lints (#120) * ci: add `golangci-lint` + fix lints * switched order --- .github/workflows/test.yml | 4 ++++ .golangci.yml | 27 ++++++++++++++++++++++++ internal/provider/example_data_source.go | 2 +- internal/provider/example_resource.go | 2 +- main.go | 6 +++--- 5 files changed, 36 insertions(+), 5 deletions(-) create mode 100644 .golangci.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7ae10dd..e247fbd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -29,6 +29,10 @@ jobs: cache: true - run: go mod download - run: go build -v . + - name: Run linters + uses: golangci/golangci-lint-action@08e2f20817b15149a52b5b3ebe7de50aff2ba8c5 # v3.4.0 + with: + version: latest generate: runs-on: ubuntu-latest diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..223cf95 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,27 @@ +# Visit https://golangci-lint.run/ for usage documentation +# and information on other useful linters +issues: + max-per-linter: 0 + max-same-issues: 0 + +linters: + disable-all: true + enable: + - durationcheck + - errcheck + - exportloopref + - forcetypeassert + - godot + - gofmt + - gosimple + - ineffassign + - makezero + - misspell + - nilerr + - predeclared + - staticcheck + - tenv + - unconvert + - unparam + - unused + - vet \ No newline at end of file diff --git a/internal/provider/example_data_source.go b/internal/provider/example_data_source.go index 486aab8..d2645d4 100644 --- a/internal/provider/example_data_source.go +++ b/internal/provider/example_data_source.go @@ -11,7 +11,7 @@ import ( "github.com/hashicorp/terraform-plugin-log/tflog" ) -// Ensure provider defined types fully satisfy framework interfaces +// Ensure provider defined types fully satisfy framework interfaces. var _ datasource.DataSource = &ExampleDataSource{} func NewExampleDataSource() datasource.DataSource { diff --git a/internal/provider/example_resource.go b/internal/provider/example_resource.go index 605900b..570216a 100644 --- a/internal/provider/example_resource.go +++ b/internal/provider/example_resource.go @@ -14,7 +14,7 @@ import ( "github.com/hashicorp/terraform-plugin-log/tflog" ) -// Ensure provider defined types fully satisfy framework interfaces +// Ensure provider defined types fully satisfy framework interfaces. var _ resource.Resource = &ExampleResource{} var _ resource.ResourceWithImportState = &ExampleResource{} diff --git a/main.go b/main.go index bf7caca..dca9bed 100644 --- a/main.go +++ b/main.go @@ -21,11 +21,11 @@ import ( var ( // these will be set by the goreleaser configuration - // to appropriate values for the compiled binary + // to appropriate values for the compiled binary. version string = "dev" - // goreleaser can also pass the specific commit if you want - // commit string = "" + // goreleaser can pass other information to the main package, such as the specific commit + // https://goreleaser.com/cookbooks/using-main.version/ ) func main() {