Skip to content
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

chore: golangci-lint update #2248

Merged
merged 3 commits into from
Jun 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/pre-submit.lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ jobs:
with:
go-version-file: "go.mod"
- env:
GOLANGCI_LINT_VERSION: "1.52.2"
GOLANGCI_LINT_CHECKSUM: "c9cf72d12058a131746edd409ed94ccd578fbd178899d1ed41ceae3ce5f54501"
GOLANGCI_LINT_VERSION: "1.53.2"
GOLANGCI_LINT_CHECKSUM: "2298f73b9bc03b88b91fee06c5d519fc7f9d7f328e2c388615bbd7e85a9d6cae"
run: |
set -euo pipefail

Expand Down
41 changes: 41 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,47 @@ linters:
# TODO(github.com/slsa-framework/slsa-github-generator/issues/450): enable thelper
# - wrapcheck
linters-settings:
depguard:
rules:
all:
files:
- $all
allow:
- $gostd

# Approved orgs.
- "github.com/slsa-framework"
- "github.com/in-toto"
- "github.com/google"
- "github.com/sigstore"
- "github.com/secure-systems-lab"
- "github.com/go-openapi"

# Approved packages.
- "github.com/spf13/cobra" # For CLI
- "github.com/coreos/go-oidc" # For verifying OIDC tokens.

# Allowed packages in container-based builder.
- "github.com/pelletier/go-toml" # For container-based builder config.
deny:
- pkg: "reflect"
desc: Please don't use reflect package
- pkg: "unsafe"
desc: Please don't use unsafe package

main:
files:
- $all
# This is an exception for the container-based builder to allow it to use go-cmp.
# TODO(#2247): Don't allow go-cmp in non-test code.
- "!**/internal/builders/docker/commands.go"
# NOTE: test code is allowed to use github.com/google/go-cmp (there is no
# deny for it) but non-test code is not.
- "!$test"
deny:
- pkg: "github.com/google/go-cmp"
desc: Please don't use go-cmp for non-test code.

errcheck:
check-type-assertions: true
check-blank: true
Expand Down