-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ci): switch to golangci-lint and fix lints (#417)
Switches the project to use the more full-featured `golangci-lint` with a suite of recommended linters coming from the `terraform-provider-scaffolding-framework` ([link](https://github.com/hashicorp/terraform-provider-scaffolding-framework/blob/main/.golangci.yml)) but electing to disable `godot` and customize some of the lints applied against the SDKv2 portion of the provider.
- Loading branch information
Showing
53 changed files
with
127 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,12 @@ jobs: | |
uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: "go.mod" | ||
cache: true | ||
cache: false # https://github.com/golangci/golangci-lint-action/issues/807 | ||
|
||
- name: Lint | ||
uses: golangci/[email protected] | ||
with: | ||
version: latest | ||
|
||
- name: Build | ||
run: go build -v . | ||
|
@@ -75,37 +80,3 @@ jobs: | |
|
||
- name: Generate Coverage Report | ||
uses: codecov/[email protected] | ||
|
||
fmt: | ||
name: Formatting | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: "go.mod" | ||
cache: true | ||
|
||
- name: Check formatting | ||
run: | | ||
# install goimports from another directory to not touch go.mod | ||
pushd ../ | ||
go install golang.org/x/tools/cmd/[email protected] | ||
popd | ||
goimports -l -w . | ||
if ! git diff --quiet; then | ||
echo Running goimports has caused changes, please run go fmt | ||
exit 1 | ||
fi | ||
go mod tidy | ||
if ! git diff --quiet; then | ||
echo 'go mod tidy' has caused changes, please run go mod tidy | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
issues: | ||
max-issues-per-linter: 0 | ||
max-same-issues: 0 | ||
exclude-rules: | ||
- path: '(.+)_test\.go' | ||
linters: | ||
- errcheck | ||
# disabling both of these for the SDKv2-based code as it's idomatic for the SDK | ||
- path: honeycombio/* | ||
text: "Error return value of `d.Set` is not checked" | ||
- path: honeycombio/* | ||
text: "type assertion must be checked" | ||
|
||
linters-settings: | ||
goimports: | ||
local-prefixes: github.com/honeycombio/terraform-provider-honeycombio | ||
|
||
linters: | ||
disable-all: true | ||
enable: | ||
- durationcheck | ||
- errcheck | ||
- exportloopref | ||
- forcetypeassert | ||
- goimports | ||
- gosimple | ||
- ineffassign | ||
- makezero | ||
- misspell | ||
- nilerr | ||
- predeclared | ||
- staticcheck | ||
- tenv | ||
- unconvert | ||
- unparam | ||
- unused | ||
- vet | ||
|
||
run: | ||
# Prevent false positive timeouts in CI | ||
timeout: 5m | ||
tests: true | ||
allow-parallel-runners: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.