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

explicitly set and use Go toolchain version specified in go.mod #43

Merged
merged 1 commit into from
Sep 10, 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
3 changes: 0 additions & 3 deletions .github/constants.env

This file was deleted.

8 changes: 1 addition & 7 deletions .github/workflows/check-generated.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,10 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3

- name: Export constant environmental variables
uses: cardinalby/export-env-action@v2
with:
envFile: .github/constants.env

- name: Install Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}.x
check-latest: true
go-version-file: go.mod

# Install any tools 'go generate' uses here

Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ jobs:
with:
languages: ${{ matrix.language }}

# TODO: remove once https://github.com/github/codeql/issues/13992 is fixed
- name: Install Go
uses: actions/setup-go@v4
with:
go-version-file: go.mod

- name: Autobuild
uses: github/codeql-action/autobuild@v2

Expand Down
8 changes: 1 addition & 7 deletions .github/workflows/lint-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,10 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3

- name: Export constant environmental variables
uses: cardinalby/export-env-action@v2
with:
envFile: .github/constants.env

- name: Install Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}.x
check-latest: true
go-version-file: go.mod

- name: Lint workflow files
run: |
Expand Down
27 changes: 5 additions & 22 deletions .github/workflows/lint-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,15 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3

- name: Export constant environmental variables
uses: cardinalby/export-env-action@v2
with:
envFile: .github/constants.env

- name: Install Go
id: install-go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}.x
check-latest: true
go-version-file: go.mod

- name: Ensure go.mod was tidied
run: |
go mod tidy -compat ${{ env.GO_VERSION }}
go mod tidy -compat ${{ steps.install-go.outputs.go-version }}
STATUS=$(git status --porcelain go.mod go.sum)
if [ -n "$STATUS" ]; then
echo "Running 'go mod tidy' modified go.mod and/or go.sum"
Expand All @@ -46,16 +41,10 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3

- name: Export constant environmental variables
uses: cardinalby/export-env-action@v2
with:
envFile: .github/constants.env

- name: Install Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}.x
check-latest: true
go-version-file: go.mod

- name: Lint with staticcheck
uses: dominikh/[email protected]
Expand All @@ -71,16 +60,10 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3

- name: Export constant environmental variables
uses: cardinalby/export-env-action@v2
with:
envFile: .github/constants.env

- name: Install Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}.x
check-latest: true
go-version-file: go.mod

- name: Lint with golangci-lint
uses: golangci/[email protected]
8 changes: 1 addition & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,13 @@ jobs:
with:
fetch-depth: 0

- name: Export constant environmental variables
uses: cardinalby/export-env-action@v2
with:
envFile: .github/constants.env

- name: Checkout tags
run: git fetch --force --tags

- name: Install Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}.x
check-latest: true
go-version-file: go.mod

- name: Install cosign
uses: sigstore/cosign-installer@main
Expand Down
16 changes: 2 additions & 14 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,10 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3

- name: Export constant environmental variables
uses: cardinalby/export-env-action@v2
with:
envFile: .github/constants.env

- name: Install Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}.x
check-latest: true
go-version-file: go.mod

- name: Ensure main package builds
run: |
Expand All @@ -45,16 +39,10 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3

- name: Export constant environmental variables
uses: cardinalby/export-env-action@v2
with:
envFile: .github/constants.env

- name: Install Go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}.x
check-latest: true
go-version-file: go.mod

- name: Fuzz code for 10 minutes
run: |
Expand Down
19 changes: 2 additions & 17 deletions .github/workflows/vuln.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,6 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Export constant environmental variables
uses: cardinalby/export-env-action@v2
with:
envFile: .github/constants.env

- name: Install Go
uses: actions/setup-go@v4
- uses: golang/[email protected]
with:
go-version: ${{ env.GO_VERSION }}.x
check-latest: true

- name: Scan for known vulnerable dependencies
run: |
go install golang.org/x/vuln/cmd/govulncheck@latest
govulncheck ./...
go-version-file: go.mod
4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module github.com/capnspacehook/go-project-template

go 1.19
go 1.21.0

toolchain go1.21.1

require go.uber.org/zap v1.25.0

Expand Down
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A=
github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk=
go.uber.org/goleak v1.2.0/go.mod h1:XJYK+MuIchqpmGmUSAzotztawfKvYLUIgg7guXrwVUo=
go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ=
go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
go.uber.org/zap v1.25.0 h1:4Hvk6GtkucQ790dqmj7l1eEnRdKm3k3ZUrUMS2d5+5c=
go.uber.org/zap v1.25.0/go.mod h1:JIAUzQIH94IC4fOJQm7gMmBJP5k7wQfdcnYdPoEXJYk=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=