Parcourir la source

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

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

* switched order
Austin Valle il y a 2 ans
Parent
commit
fa8056ce94

+ 4 - 0
.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

+ 27 - 0
.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

+ 1 - 1
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 {

+ 1 - 1
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{}
 

+ 3 - 3
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() {