ci: add golangci-lint + fix lints (#120)

* ci: add `golangci-lint` + fix lints

* switched order
This commit is contained in:
Austin Valle 2023-01-26 14:24:42 -05:00 committed by GitHub
parent b915d9f8e1
commit fa8056ce94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 36 additions and 5 deletions

View File

@ -29,6 +29,10 @@ jobs:
cache: true cache: true
- run: go mod download - run: go mod download
- run: go build -v . - run: go build -v .
- name: Run linters
uses: golangci/golangci-lint-action@08e2f20817b15149a52b5b3ebe7de50aff2ba8c5 # v3.4.0
with:
version: latest
generate: generate:
runs-on: ubuntu-latest runs-on: ubuntu-latest

27
.golangci.yml Normal file
View File

@ -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

View File

@ -11,7 +11,7 @@ import (
"github.com/hashicorp/terraform-plugin-log/tflog" "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{} var _ datasource.DataSource = &ExampleDataSource{}
func NewExampleDataSource() datasource.DataSource { func NewExampleDataSource() datasource.DataSource {

View File

@ -14,7 +14,7 @@ import (
"github.com/hashicorp/terraform-plugin-log/tflog" "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.Resource = &ExampleResource{}
var _ resource.ResourceWithImportState = &ExampleResource{} var _ resource.ResourceWithImportState = &ExampleResource{}

View File

@ -21,11 +21,11 @@ import (
var ( var (
// these will be set by the goreleaser configuration // 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" version string = "dev"
// goreleaser can also pass the specific commit if you want // goreleaser can pass other information to the main package, such as the specific commit
// commit string = "" // https://goreleaser.com/cookbooks/using-main.version/
) )
func main() { func main() {