Skip to content

Commit dd7df58

Browse files
authored
Upgrade internal/tools go module for x/tools and mockery (#1421)
Mockery is failing when run with go 1.24 due to vektra/mockery#914 , so let's upgrade it. Basic steps to upgrade are: ``` # add go toolchain to go.mod to enforce a higher minimum cd internal/tools go get golang.org/x/tools@latest github.com/vektra/mockery/v2@latest cd ../.. make all ``` and some careful reading to verify the results. And then some changes to address our CI needs, e.g. since runtime and tool-time versions have diverged (currently) we now automatically pull and build with the old version. Most of these version values can be found by doing a grep like ``` ❯ rg 'go(lang)?.?1.?2\d' go.mod 3:go 1.21 # intentionally different docker/buildkite/Dockerfile 1:FROM golang:1.24 Makefile 36:EXPECTED_GO_VERSION := go1.24 CHANGELOG.md 28:- Bump x/tools for tools, to support go 1.22 (#1336) 143:- Fix TestActivityWorkerStop: it times out with go 1.20 by @dkrotx in #1223 internal/tools/go.mod 3:go 1.23.0 5:toolchain go1.24.2 ``` I had _expected_ `go 1.21` in go.mod to take care of this kind of check, but apparently not: golang/go#73603 so it's now done by hand. --- There are *some* changes which I think stand a very small chance of causing problems: - Our RPC client's mocks now check for `.Get(0).(func(args) (any, error)` signatures where before they did not - I believe anyone using this would've hit a `.Error` further down after these changes, so hopefully this just fixes buggy behavior and does not cause any existing tests to fail - Many funcs gained a `if len(ret) == 0 { panic(..) }` check - Since there's a `ret.Get(0)` immediately after which also panics, I suspect this just gives better error messages. - Our mocks now have a `DoAndReturn` method - Since there are no interfaces for all this, this should be fine, ignoring reflection (which we must ignore or else we will go mad). Otherwise seems like nothing exciting, and this does not affect any user-facing libraries or Go versions. Since this needs a newer CI Go version to build, I've updated those references too. --- Separately, this was the source of some rather disturbing TILs: ```bash ❯ bash -ec ' [[[ "$a" = "foo"]] && echo first echo second ' bash: line 2: [[[: command not found second ❯ echo $? 0 ``` Apparently syntax errors are (sometimes) not script failures, even with `set -e`. And `sh` does not support `[[`, so it was _printing an error_ and continuing without erroring. CI uses `sh`, locally we generally get bash or zsh, so a locally-working `[[` may be a remote-silently-failing command. Madness. Absolute madness. This is going to haunt me for a while, unless I can find a way to prevent it (without shellcheck).
1 parent d9dcddc commit dd7df58

15 files changed

+464
-513
lines changed

.github/workflows/codecov.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- name: Set up Go
1414
uses: actions/setup-go@v4
1515
with:
16-
go-version: 1.21.x
16+
go-version: 1.24.x
1717
cache: false
1818

1919
- name: Download dependencies

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77
## [Unreleased]
88
### Added
99
- Added worker.NewV2 with validation on decision poller count (#1370)
10+
- Upgraded internal tooling to support Go 1.24, should be no user-noticeable changes (#1421)
1011

1112
## [v1.2.10] - 2024-07-10
1213
### Added

Makefile

+9-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ BIN := $(BUILD)/bin
3333
#
3434
# this can _likely_ remain a major version, as fmt output does not tend to change in minor versions,
3535
# which will allow findstring to match any minor version.
36-
EXPECTED_GO_VERSION := go1.21
36+
EXPECTED_GO_VERSION := go1.24
3737
CURRENT_GO_VERSION := $(shell go version)
3838
ifeq (,$(findstring $(EXPECTED_GO_VERSION),$(CURRENT_GO_VERSION)))
3939
# if you are seeing this warning: consider using https://github.com/travis-ci/gimme to pin your version
@@ -278,6 +278,14 @@ build: $(BUILD)/fmt ## ensure all packages build
278278
go build ./...
279279
$Q # caution: some errors are reported on stdout for some reason
280280
go test -exec true ./... >/dev/null
281+
$Q # compare the current go version with what is in go.mod, and get `{gomod_version}.1` or similar and ensure it builds.
282+
$Q GOVERSION="$(shell go env GOVERSION | cut -d. -f1-2)" \
283+
MODVERSION="go$(shell grep '^go 1' go.mod | cut -d' ' -f2)"; \
284+
if [ "$$GOVERSION" != "$$MODVERSION" ]; then \
285+
echo "go.mod version \"$$MODVERSION\" is not the same as current go version \"$$GOVERSION\", making sure it builds..."; \
286+
echo GOTOOLCHAIN="$$MODVERSION".1 go build ./...; \
287+
GOTOOLCHAIN="$$MODVERSION".1 go build ./...; \
288+
fi
281289

282290
.PHONY: lint
283291
# useful to actually re-run to get output again.

docker/buildkite/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.21
1+
FROM golang:1.24
22

33
RUN mkdir -p /go/src/go.uber.org/cadence
44
WORKDIR /go/src/go.uber.org/cadence

internal/internal_workflow_task_handler_mock.go

+17-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/local_dispatcher_mock.go

+13-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/service_invoker_mock.go

+46-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/tools/go.mod

+30-29
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,66 @@
11
module go.uber.org/cadence/internal/tools
22

3-
go 1.21
3+
go 1.23.0
4+
5+
toolchain go1.24.2
46

57
require (
68
github.com/kisielk/errcheck v1.6.3
79
github.com/mattn/goveralls v0.0.11
810
github.com/mgechev/revive v1.2.5
911
// last used version, would likely be good to upgrade if possible
10-
github.com/vektra/mockery/v2 v2.16.0
12+
github.com/vektra/mockery/v2 v2.53.3
1113
go.uber.org/thriftrw v1.25.0
1214
go.uber.org/yarpc v1.55.0
13-
golang.org/x/tools v0.21.0
15+
golang.org/x/tools v0.32.0
1416
honnef.co/go/tools v0.4.0
1517
)
1618

1719
require (
1820
github.com/BurntSushi/toml v1.2.1 // indirect
1921
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 // indirect
2022
github.com/chavacava/garif v0.0.0-20221024190013-b3ef35877348 // indirect
21-
github.com/chigopher/pathlib v0.12.0 // indirect
23+
github.com/chigopher/pathlib v0.19.1 // indirect
2224
github.com/fatih/color v1.14.1 // indirect
2325
github.com/fatih/structtag v1.2.0 // indirect
24-
github.com/fsnotify/fsnotify v1.5.4 // indirect
26+
github.com/fsnotify/fsnotify v1.8.0 // indirect
27+
github.com/go-viper/mapstructure/v2 v2.2.1 // indirect
2528
github.com/golang/mock v1.5.0 // indirect
26-
github.com/hashicorp/hcl v1.0.0 // indirect
27-
github.com/inconshreveable/mousetrap v1.0.0 // indirect
29+
github.com/huandu/xstrings v1.4.0 // indirect
30+
github.com/iancoleman/strcase v0.3.0 // indirect
31+
github.com/inconshreveable/mousetrap v1.1.0 // indirect
2832
github.com/jessevdk/go-flags v1.4.0 // indirect
29-
github.com/magiconair/properties v1.8.6 // indirect
30-
github.com/mattn/go-colorable v0.1.13 // indirect
31-
github.com/mattn/go-isatty v0.0.17 // indirect
33+
github.com/jinzhu/copier v0.4.0 // indirect
34+
github.com/mattn/go-colorable v0.1.14 // indirect
35+
github.com/mattn/go-isatty v0.0.20 // indirect
3236
github.com/mattn/go-runewidth v0.0.14 // indirect
3337
github.com/mgechev/dots v0.0.0-20210922191527-e955255bf517 // indirect
3438
github.com/mitchellh/go-homedir v1.1.0 // indirect
3539
github.com/mitchellh/mapstructure v1.5.0 // indirect
3640
github.com/olekukonko/tablewriter v0.0.5 // indirect
37-
github.com/pelletier/go-toml v1.9.5 // indirect
38-
github.com/pelletier/go-toml/v2 v2.0.2 // indirect
41+
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
3942
github.com/pkg/errors v0.9.1 // indirect
4043
github.com/rivo/uniseg v0.4.3 // indirect
41-
github.com/rs/zerolog v1.27.0 // indirect
42-
github.com/spf13/afero v1.8.2 // indirect
43-
github.com/spf13/cast v1.5.0 // indirect
44-
github.com/spf13/cobra v1.4.0 // indirect
45-
github.com/spf13/jwalterweatherman v1.1.0 // indirect
46-
github.com/spf13/pflag v1.0.5 // indirect
47-
github.com/spf13/viper v1.12.0 // indirect
48-
github.com/subosito/gotenv v1.4.0 // indirect
44+
github.com/rs/zerolog v1.33.0 // indirect
45+
github.com/sagikazarmark/locafero v0.7.0 // indirect
46+
github.com/sourcegraph/conc v0.3.0 // indirect
47+
github.com/spf13/afero v1.12.0 // indirect
48+
github.com/spf13/cast v1.7.1 // indirect
49+
github.com/spf13/cobra v1.8.1 // indirect
50+
github.com/spf13/pflag v1.0.6 // indirect
51+
github.com/spf13/viper v1.20.0 // indirect
52+
github.com/subosito/gotenv v1.6.0 // indirect
4953
github.com/uber/tchannel-go v1.32.1 // indirect
5054
go.uber.org/atomic v1.9.0 // indirect
5155
go.uber.org/fx v1.13.1 // indirect
52-
go.uber.org/multierr v1.6.0 // indirect
56+
go.uber.org/multierr v1.11.0 // indirect
5357
go.uber.org/zap v1.17.0 // indirect
54-
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e // indirect
5558
golang.org/x/exp/typeparams v0.0.0-20230203172020-98cc5a0785f9 // indirect
56-
golang.org/x/mod v0.17.0 // indirect
57-
golang.org/x/sync v0.7.0 // indirect
58-
golang.org/x/sys v0.20.0 // indirect
59-
golang.org/x/term v0.0.0-20220526004731-065cf7ba2467 // indirect
60-
golang.org/x/text v0.6.0 // indirect
61-
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
62-
gopkg.in/ini.v1 v1.66.6 // indirect
59+
golang.org/x/mod v0.24.0 // indirect
60+
golang.org/x/sync v0.13.0 // indirect
61+
golang.org/x/sys v0.32.0 // indirect
62+
golang.org/x/term v0.29.0 // indirect
63+
golang.org/x/text v0.22.0 // indirect
6364
gopkg.in/yaml.v2 v2.4.0 // indirect
6465
gopkg.in/yaml.v3 v3.0.1 // indirect
6566
)

0 commit comments

Comments
 (0)