Skip to content

Commit

Permalink
Update golangci-lint and add depguard rules (#3051)
Browse files Browse the repository at this point in the history
* update golangci-lint to v1.53.x

Signed-off-by: cpanato <[email protected]>

* add golangci-lint depguard rules

Signed-off-by: cpanato <[email protected]>

---------

Signed-off-by: cpanato <[email protected]>
  • Loading branch information
cpanato authored Jun 13, 2023
1 parent 86da4aa commit 78aacd1
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -178,5 +178,5 @@ jobs:
uses: golangci/golangci-lint-action@639cd343e1d3b897ff35927a75193d57cfcba299 # v3.6.0
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.52
version: v1.53
args: --timeout=5m
75 changes: 75 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,81 @@ linters-settings:
- 'os\.Getenv.*'
- 'os\.LookupEnv.*'
exclude_godoc_examples: false
depguard:
rules:
main:
files:
- $all
- "!$test"
allow:
- $gostd

- github.com/open-policy-agent/opa/rego
- github.com/xanzy/go-gitlab
- github.com/spf13/cobra
- github.com/spf13/viper
- github.com/spf13/pflag
- github.com/pkg/errors
- github.com/moby/term
- github.com/google/go-cmp/cmp
- github.com/in-toto/in-toto-golang
- github.com/secure-systems-lab/go-securesystemslib
- github.com/cyberphone/json-canonicalization/go/src/webpki.org/jsoncanonicalizer
- github.com/digitorus/timestamp
- github.com/transparency-dev/merkle
- github.com/google/certificate-transparency-go
- github.com/go-openapi
- github.com/theupdateframework/go-tuf
- github.com/kelseyhightower/envconfig
- github.com/google/go-github
- github.com/buildkite/agent
- github.com/mitchellh/go-wordwrap
- github.com/withfig/autocomplete-tools/integrations/cobra
- github.com/awslabs/amazon-ecr-credential-helper/ecr-login
- github.com/chrismellard/docker-credential-acr-env/pkg/credhelper
- github.com/mozillazg/docker-credential-acr-helper/pkg/credhelper

- cuelang.org/go/cue/load
- cuelang.org/go/cue/cuecontext
- cuelang.org/go/encoding/json

- k8s.io/utils/pointer
- k8s.io/client-go
- k8s.io/api/core
- k8s.io/apimachinery
- sigs.k8s.io/release-utils/version

- github.com/spiffe/go-spiffe
- github.com/google/go-containerregistry
- github.com/sigstore

test:
files:
- $test
allow:
- $gostd
- github.com/google/go-cmp/cmp
- github.com/go-openapi
- github.com/google/go-containerregistry
- github.com/in-toto/in-toto-golang
- github.com/stretchr/testify
- github.com/pkg/errors
- github.com/theupdateframework/go-tuf
- github.com/google/certificate-transparency-go
- github.com/secure-systems-lab/go-securesystemslib
- github.com/transparency-dev/merkle/rfc6962
- github.com/depcheck-test/depcheck-test/depcheck
- github.com/cyberphone/json-canonicalization/go/src/webpki.org/jsoncanonicalizer

- k8s.io/api/core
- k8s.io/apimachinery
- k8s.io/utils/pointer

- github.com/sigstore/cosign
- github.com/sigstore/sigstore
- github.com/sigstore/rekor
- github.com/sigstore/fulcio

output:
uniq-by-line: false
issues:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ cross:
golangci-lint:
rm -f $(GOLANGCI_LINT_BIN) || :
set -e ;\
GOBIN=$(GOLANGCI_LINT_DIR) $(GOEXE) install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.52.2 ;\
GOBIN=$(GOLANGCI_LINT_DIR) $(GOEXE) install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.53.2 ;\

lint: golangci-lint ## Run golangci-lint linter
$(GOLANGCI_LINT_BIN) run -n
Expand Down

0 comments on commit 78aacd1

Please sign in to comment.