Skip to content

Commit 3afe949

Browse files
authored
Merge pull request #18017 from MadhavJivrajani/go-version-setup-35
[release-3.5] Setup a way to consistently manage go versions across scripts and go.mods
2 parents 297130d + 3c990bc commit 3afe949

File tree

17 files changed

+162
-0
lines changed

17 files changed

+162
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
name: Static Analysis
3+
on: [push, pull_request]
4+
permissions: read-all
5+
jobs:
6+
run:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
10+
- id: goversion
11+
run: echo "goversion=$(cat .go-version)" >> "$GITHUB_OUTPUT"
12+
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
13+
with:
14+
go-version: ${{ steps.goversion.outputs.goversion }}
15+
- run: |
16+
set -euo pipefail
17+
18+
make verify
19+
- run: |
20+
set -euo pipefail
21+
22+
make fix
23+
24+
DIFF=$(git status --porcelain)
25+
26+
if [ -n "$DIFF" ]; then
27+
echo "These files were modified:"
28+
echo
29+
echo "$DIFF"
30+
echo
31+
exit 1
32+
fi

Makefile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,3 +580,18 @@ gofail-enable: install-gofail
580580
.PHONY: gofail-disable
581581
gofail-disable: install-gofail
582582
PASSES="toggle_failpoints" ./test.sh
583+
584+
.PHONY: verify
585+
verify: verify-go-versions
586+
587+
.PHONY: verify-go-versions
588+
verify-go-versions:
589+
./scripts/verify_go_versions.sh
590+
591+
.PHONY: fix
592+
fix: sync-toolchain-directive
593+
./scripts/fix.sh
594+
595+
.PHONY: sync-toolchain-directive
596+
sync-toolchain-directive:
597+
./scripts/sync_go_toolchain_directive.sh

api/go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ module go.etcd.io/etcd/api/v3
22

33
go 1.21
44

5+
toolchain go1.21.10
6+
57
require (
68
github.com/coreos/go-semver v0.3.0
79
github.com/gogo/protobuf v1.3.2

client/pkg/go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ module go.etcd.io/etcd/client/pkg/v3
22

33
go 1.21
44

5+
toolchain go1.21.10
6+
57
require (
68
github.com/coreos/go-systemd/v22 v22.3.2
79
github.com/stretchr/testify v1.8.4

client/v2/go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ module go.etcd.io/etcd/client/v2
22

33
go 1.21
44

5+
toolchain go1.21.10
6+
57
require (
68
github.com/json-iterator/go v1.1.11
79
github.com/modern-go/reflect2 v1.0.1

client/v3/go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ module go.etcd.io/etcd/client/v3
22

33
go 1.21
44

5+
toolchain go1.21.10
6+
57
require (
68
github.com/dustin/go-humanize v1.0.0
79
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0

etcdctl/go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ module go.etcd.io/etcd/etcdctl/v3
22

33
go 1.21
44

5+
toolchain go1.21.10
6+
57
require (
68
github.com/bgentry/speakeasy v0.1.0
79
github.com/dustin/go-humanize v1.0.0

etcdutl/go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ module go.etcd.io/etcd/etcdutl/v3
22

33
go 1.21
44

5+
toolchain go1.21.10
6+
57
replace (
68
go.etcd.io/etcd/api/v3 => ../api
79
go.etcd.io/etcd/client/pkg/v3 => ../client/pkg

go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ module go.etcd.io/etcd/v3
22

33
go 1.21
44

5+
toolchain go1.21.10
6+
57
replace (
68
go.etcd.io/etcd/api/v3 => ./api
79
go.etcd.io/etcd/client/pkg/v3 => ./client/pkg

pkg/go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ module go.etcd.io/etcd/pkg/v3
22

33
go 1.21
44

5+
toolchain go1.21.10
6+
57
require (
68
github.com/creack/pty v1.1.11
79
github.com/dustin/go-humanize v1.0.0

0 commit comments

Comments
 (0)