Skip to content

Commit

Permalink
Merge pull request #35938 from hashicorp/f-make-gover
Browse files Browse the repository at this point in the history
make: Default tidy to default Go version
  • Loading branch information
YakDriver authored Feb 22, 2024
2 parents e3b434c + 274edc5 commit 3645bd0
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 11 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,11 @@ jobs:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version-file: go.mod
go-version-file: .go-version
- name: go mod
run: |
echo "==> Checking source code with go mod tidy..."
go mod tidy
git diff --exit-code -- go.mod go.sum || \
(echo; echo "Unexpected difference in go.mod/go.sum files. Run 'go mod tidy' command or revert any go.mod/go.sum changes and commit."; exit 1)
gover=go`cat .go-version | xargs`
go install golang.org/dl/${gover}@latest
${gover} download
echo "Using make to check dependencies"
make depscheck
21 changes: 15 additions & 6 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,21 @@ cleango: ## Clean up Go cache

cleantidy: ## Clean up tidy
@echo "make: tidying Go mods..."
cd .ci/providerlint && $(GO_VER) mod tidy
cd tools/tfsdk2fw && $(GO_VER) mod tidy
cd .ci/tools && $(GO_VER) mod tidy
cd .ci/providerlint && $(GO_VER) mod tidy
cd skaff && $(GO_VER) mod tidy
@$(GO_VER) mod tidy
@gover="$(GO_VER)" ; \
if [ "$$gover" = "go" ] ; then \
gover=go`cat .go-version | xargs` ; \
echo "make: WARNING: no version provided so tidying with $$gover" ; \
echo "make: tidying with newer versions can make go.mod incompatible" ; \
echo "make: to use a different version, use 'GO_VER=go1.16 make cleantidy'" ; \
echo "make: to use the version in .go-version, use 'make cleantidy'" ; \
echo "make: if you get an error, see https://go.dev/doc/manage-install to locally install various Go versions" ; \
fi ; \
cd .ci/providerlint && $$gover mod tidy && cd ../.. ; \
cd tools/tfsdk2fw && $$gover mod tidy && cd ../.. ; \
cd .ci/tools && $$gover mod tidy && cd ../.. ; \
cd .ci/providerlint && $$gover mod tidy && cd ../.. ; \
cd skaff && $$gover mod tidy && cd .. ; \
$$gover mod tidy
@echo "make: Go mods tidied"

clean: cleango cleantidy build tools ## Clean up Go cache, tidy and re-install tools
Expand Down
1 change: 1 addition & 0 deletions tools/tfsdk2fw/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ require (
github.com/aws/aws-sdk-go-v2/service/qldb v1.20.2 // indirect
github.com/aws/aws-sdk-go-v2/service/rbin v1.15.2 // indirect
github.com/aws/aws-sdk-go-v2/service/rds v1.71.2 // indirect
github.com/aws/aws-sdk-go-v2/service/redshift v1.42.2 // indirect
github.com/aws/aws-sdk-go-v2/service/redshiftdata v1.24.3 // indirect
github.com/aws/aws-sdk-go-v2/service/redshiftserverless v1.16.4 // indirect
github.com/aws/aws-sdk-go-v2/service/rekognition v1.38.2 // indirect
Expand Down
2 changes: 2 additions & 0 deletions tools/tfsdk2fw/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,8 @@ github.com/aws/aws-sdk-go-v2/service/rbin v1.15.2 h1:3WgCnpykFdYVMEqe48VSSDEtHlV
github.com/aws/aws-sdk-go-v2/service/rbin v1.15.2/go.mod h1:twjAy0rzJI3a4gLElW+9kGq9POXxMZrVZgy8/m3s7vA=
github.com/aws/aws-sdk-go-v2/service/rds v1.71.2 h1:RjlhYRut7x9YB2osQkEXqpDZxbWlK1B6Oqq1GTgh6e0=
github.com/aws/aws-sdk-go-v2/service/rds v1.71.2/go.mod h1:DSeprnsj3WlGLGUZOSNopiS9vAJ8O3mELgOk6xdYxHI=
github.com/aws/aws-sdk-go-v2/service/redshift v1.42.2 h1:zueJxn5Ib3djyG1Q8YRuOOsIbnPkB4W7v2McIsjrzGI=
github.com/aws/aws-sdk-go-v2/service/redshift v1.42.2/go.mod h1:dz/YBEp+Bq5tJka7Of0J3mW+FKXEWrCOXPU7x/OCsr4=
github.com/aws/aws-sdk-go-v2/service/redshiftdata v1.24.3 h1:yt16uONP3LGMhvTfeZmA1JWOzCAxNxbm5U6vry2Rd+g=
github.com/aws/aws-sdk-go-v2/service/redshiftdata v1.24.3/go.mod h1:r1F7/i9zaT/1pv0wsERnNVgT+VZMbrRV7eH54ea1EnA=
github.com/aws/aws-sdk-go-v2/service/redshiftserverless v1.16.4 h1:PN3J849dN9LDP/HJ18Jv3iA/koME2J3W+2qUyNzjOrk=
Expand Down

0 comments on commit 3645bd0

Please sign in to comment.