-
Notifications
You must be signed in to change notification settings - Fork 790
chore(ci): add golangci-lint #1774
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
roncodingenthusiast
merged 8 commits into
hashicorp:main
from
thevilledev:chore/golangci-lint
Sep 19, 2023
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
cdcb9b9
chore(ci): add golangci-lint
thevilledev bb34a26
add depguard
thevilledev 3e80de0
remove exclude rules
thevilledev a69bc2e
add gomodguard + depguard settings
thevilledev 29ebe76
Align setup-go GHA version
thevilledev e770f4a
Merge branch 'main' into chore/golangci-lint
thevilledev df3080d
fix depguard v2 config
thevilledev 4047c34
Merge branch 'hashicorp:main' into chore/golangci-lint
thevilledev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,22 @@ | ||
| name: lint | ||
|
|
||
| on: | ||
| pull_request: | ||
|
|
||
| jobs: | ||
| run-linters: | ||
| name: Run linters | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 | ||
| with: | ||
| go-version-file: 'go.mod' | ||
|
|
||
| - name: Run linters | ||
| uses: golangci/golangci-lint-action@639cd343e1d3b897ff35927a75193d57cfcba299 # v3.6.0 | ||
| with: | ||
| version: latest |
This file contains hidden or 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,92 @@ | ||
| # Copyright (c) HashiCorp, Inc. | ||
| # SPDX-License-Identifier: MPL-2.0 | ||
|
|
||
| linters: | ||
| disable-all: true | ||
| enable: | ||
| - gofmt | ||
| - govet | ||
| - unconvert | ||
| - staticcheck | ||
| - ineffassign | ||
| - unparam | ||
| - forbidigo | ||
| - gomodguard | ||
| - gosimple | ||
| - depguard | ||
|
|
||
| issues: | ||
| # Disable the default exclude list so that all excludes are explicitly | ||
| # defined in this file. | ||
| exclude-use-default: false | ||
|
|
||
|
|
||
| linters-settings: | ||
| govet: | ||
| check-shadowing: true | ||
| enable-all: true | ||
| disable: | ||
| - fieldalignment | ||
| - nilness | ||
| - shadow | ||
| - unusedwrite | ||
| forbidigo: | ||
| # Forbid the following identifiers (list of regexp). | ||
| forbid: | ||
| - '\bioutil\b(# Use io and os packages instead of ioutil)?' | ||
| - '\brequire\.New\b(# Use package-level functions with explicit TestingT)?' | ||
| - '\bassert\.New\b(# Use package-level functions with explicit TestingT)?' | ||
| # Exclude godoc examples from forbidigo checks. | ||
| # Default: true | ||
| exclude_godoc_examples: false | ||
| gofmt: | ||
| simplify: true | ||
|
thevilledev marked this conversation as resolved.
|
||
| gomodguard: | ||
| blocked: | ||
| # List of blocked modules. | ||
| modules: | ||
| # Blocked module. | ||
| - github.com/hashicorp/go-msgpack: | ||
| recommendations: | ||
| - github.com/hashicorp/consul-net-rpc/go-msgpack | ||
| - github.com/golang/protobuf: | ||
| recommendations: | ||
| - google.golang.org/protobuf | ||
| depguard: | ||
| rules: | ||
| main: | ||
| # List of file globs that will match this list of settings to compare against. | ||
| # Default: $all | ||
| files: | ||
| - $all | ||
| # List of allowed packages. | ||
| allow: | ||
| - $gostd | ||
| - github.com/BurntSushi/toml | ||
| - github.com/Masterminds/sprig/v3 | ||
| - github.com/davecgh/go-spew/spew | ||
| - github.com/hashicorp/consul-template | ||
| - github.com/hashicorp/consul/api | ||
| - github.com/hashicorp/consul/sdk/testutil | ||
| - github.com/hashicorp/go-gatedio | ||
| - github.com/hashicorp/go-hclog | ||
| - github.com/hashicorp/go-multierror | ||
| - github.com/hashicorp/go-rootcerts | ||
| - github.com/hashicorp/go-sockaddr/template | ||
| - github.com/hashicorp/go-syslog | ||
| - github.com/hashicorp/hcl | ||
| - github.com/hashicorp/logutils | ||
| - github.com/hashicorp/nomad/api | ||
| - github.com/hashicorp/vault/api | ||
| - github.com/imdario/mergo | ||
| - github.com/mitchellh/go-homedir | ||
| - github.com/mitchellh/hashstructure | ||
| - github.com/mitchellh/mapstructure | ||
| - github.com/pkg/errors | ||
| - github.com/stretchr/testify/assert | ||
| - github.com/stretchr/testify/require | ||
|
|
||
| run: | ||
| timeout: 10m | ||
| concurrency: 4 | ||
| skip-dirs-use-default: false | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.