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

refactor: Use Go 1.20 #643

Merged
merged 3 commits into from
Jun 26, 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
2 changes: 1 addition & 1 deletion .github/workflows/pre-submit.cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: setup-go
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with:
go-version: "1.18"
go-version-file: "go.mod"

- name: Save event name
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre-submit.e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: setup-go
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with:
go-version: "1.18"
go-version-file: "__THIS_REPO__/go.mod"

- name: Build verifier at HEAD
working-directory: __THIS_REPO__
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pre-submit.lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with:
go-version: "1.18"
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
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
contents: write # For asset uploads.
uses: slsa-framework/slsa-github-generator/.github/workflows/builder_go_slsa3.yml@v1.7.0
with:
go-version: 1.18
go-version-file: "go.mod"
config-file: .slsa-goreleaser/${{matrix.os}}-${{matrix.arch}}.yml
compile-builder: true
evaluated-envs: "VERSION:${{needs.args.outputs.version}}"
Expand Down
82 changes: 82 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,88 @@ linters:
# TODO(https://github.com/slsa-framework/slsa-verifier/issues/363): Restore linter
# - wrapcheck
linters-settings:
depguard:
rules:
global:
files:
- $all
- "!$test"
- "!**/experimental/**"

# This is an exception for the existing code.
# TODO(#642): Don't allow go-cmp in non-test code.
- "!**/verifiers/internal/gcb/provenance.go"
allow:
- $gostd

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

# Approved packages.
- "sigs.k8s.io/release-utils/version"
- "github.com/spf13/cobra" # For CLI
- "github.com/docker/go/canonical/json" # For canonical json.
- "github.com/google/go-containerregistry" # For interacting with container registries.
deny:
- pkg: "reflect"
desc: Please don't use reflect package
- pkg: "unsafe"
desc: Please don't use unsafe package

test:
files:
- "$test"
# - "!**/experimental/**"
# This is an exception for the existing code.
# TODO(#642): Don't allow go-cmp in non-test code.
- "!**/verifiers/internal/gcb/provenance.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.
allow:
- $gostd

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

# Approved packages.
- "sigs.k8s.io/release-utils/version"
- "github.com/spf13/cobra" # For CLI
- "github.com/docker/go/canonical/json" # For canonical json.
- "github.com/google/go-containerregistry" # For interacting with container registries.

# Allowed in test code.
- "github.com/google/go-cmp"
deny:
- pkg: "reflect"
desc: Please don't use reflect package
- pkg: "unsafe"
desc: Please don't use unsafe package

experimental:
files:
- "**/experimental/**/*.go"
allow:
- $gostd

# Approved orgs.
- "github.com/slsa-framework"

# Allowed in experimental.
- "github.com/gorilla/mux"
deny:
- pkg: "reflect"
desc: Please don't use reflect package
- pkg: "unsafe"
desc: Please don't use unsafe package

errcheck:
check-type-assertions: true
check-blank: true
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/slsa-framework/slsa-verifier/v2

go 1.18
go 1.20

require (
github.com/docker/go v1.5.1-1
Expand Down
Loading