-
Notifications
You must be signed in to change notification settings - Fork 860
chore: Go 1.24, and mockery, x/tools, sqlite to support it #7244
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
base: master
Are you sure you want to change the base?
Conversation
signalDelayCount++ | ||
if signalDelayCount > params.MaxSignalDelayCount { | ||
return fmt.Errorf(fmt.Sprintf("received %v signals are longer than %v seconds.", params.MaxSignalDelayCount, params.MaxSignalDelayInSeconds)) | ||
return fmt.Errorf("received %v signals are longer than %v seconds", params.MaxSignalDelayCount, params.MaxSignalDelayInSeconds) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new vet check, required to compile tests.
metricsScope := &mocks.Scope{} | ||
metricsClient. | ||
On("Scope", metrics.MessagingClientPublishScope, metrics.TopicTag("test-topic-1")). | ||
On("Scope", metrics.MessagingClientPublishScope, []metrics.Tag{metrics.TopicTag("test-topic-1")}). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pickier about types, it seems.
this doesn't change between On
and EXPECT().Method
.
given that the codegen knows this is a varargs, I think this is probably a codegen/mock-library gap that should be fixed. but we have few uses so it's really not a blocker for us.
}) | ||
if err != nil { | ||
return false, c.failed("failed to get concrete execution record", err.Error()) | ||
return false, c.failed("failed to get concrete execution record", "%v", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also forced by the new vet check. it detects calls through funcs! neat.
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN pip install cqlsh | ||
RUN pip install cqlsh --break-system-packages |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so glad python started forcing this
seed := int64(1) | ||
rand.Seed(seed) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://tip.golang.org/doc/go1.24#mathrandpkgmathrand
Calls to the deprecated top-level Seed function no longer have any effect. To restore the old behavior use GODEBUG setting randseednop=0. For more background see proposal #67273.
we have a few other seed calls, but they don't seem to be load-bearing like the ones in this test were.
so I just worked around this with a custom (sadly verbose) matcher.
|
||
# Build Cadence binaries | ||
FROM golang:1.23.4-alpine3.21 AS builder | ||
FROM golang:1.24.7-alpine3.21 AS builder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried a bit to convert our github-action to alpine too, but hit too many barriers and gave up fairly quickly :|
probably doesn't matter if the actions/setup-go
ones are debian/ubuntu? though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, as long as the images are cached, debian's honestly usually a little easier to work with
|
||
# lints that go modules are as expected, e.g. parent does not import submodule. | ||
# tool builds that need to be in sync with the parent are partially checked through go_mod_build_tool, but should probably be checked here too | ||
$(BUILD)/gomod-lint: go.mod internal/tools/go.mod common/archiver/gcloud/go.mod | $(BUILD) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was missing a couple
$Q # tidy in dependency order | ||
$Q # tidy needs to run in dependency order: | ||
$Q # everything depends on the main module, server depends on everything else so it should be last. | ||
$Q # but we can just tidy everything 2x, which should be stable as our dependency tree is only 2 deep. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tried to come up with a different approach, but nothing seemed more reliable than "just run it twice lol". and we can easily increase it if we ever have a 3-deep chain, still without caring about their dependency orders - reruns are generally less than a second so it hardly matters.
|
||
// GetRemoteAdminClient mocks base method. | ||
func (m *MockResource) GetRemoteAdminClient(cluster string) (admin.Client, error) { | ||
func (m *MockResource) GetRemoteAdminClient(arg0 string) (admin.Client, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is one of those "worse codegen from gomock" cases
|
||
// UpdateTimerProcessingQueueStates mocks base method. | ||
func (m *MockContext) UpdateTimerProcessingQueueStates(cluster string, states []*types.ProcessingQueueState) error { | ||
func (m *MockContext) UpdateTimerProcessingQueueStates(arg0 string, states []*types.ProcessingQueueState) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see, this one changes the first, not the second, while others change the second but not the first.
if it wasn't stable, I'd be concerned, but it re-gens the same every time so...
|
||
// GetQueueClusterAckLevel mocks base method. | ||
func (m *MockContext) GetQueueClusterAckLevel(category persistence.HistoryTaskCategory, cluster string) persistence.HistoryTaskKey { | ||
func (m *MockContext) GetQueueClusterAckLevel(category persistence.HistoryTaskCategory, arg1 string) persistence.HistoryTaskKey { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changes the second, not the first
Signed-off-by: Steven L <[email protected]>
@@ -0,0 +1,85 @@ | |||
all: false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice, is this intended to be comprehensive or it's just some problematic ones?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"all" is for whether it'll generate mocks of every interface it discovers, or if it's an explicit list (below). e.g. you could use it for "all" in a subdir, if it always contained interfaces you wanted to mock (like an "interfaces" dir).
I don't think we'll ever get even close to wanting that tho :)
$Q cd common/archiver/gcloud; go mod tidy || (echo "failed to tidy gcloud plugin, try manually copying go.mod contents into common/archiver/gcloud/go.mod and rerunning" >&2; exit 1) | ||
$Q cd cmd/server; go mod tidy || (echo "failed to tidy main server module, try manually copying go.mod and common/archiver/gcloud/go.mod contents into cmd/server/go.mod and rerunning" >&2; exit 1) | ||
$Q $(foreach sub,$(SUBMODULE_PATHS), \ | ||
$Q cd $(sub); go mod tidy || $$(>&2 echo "failed to tidy $(sub) plugin, try manually copying go.mod contents into $(sub)/go.mod and rerunning by hand"; exit 1)$(NEWLINE) \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no change requested, but this is getting into probably-should-be-a-script territory in future.
// to the source files. Usage as follows: | ||
// | ||
// ./cmd/tools/copyright/licensegen.go | ||
func main() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the story with this? I wasn't following along, do we not need it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mostly just leftovers from #6882 which isn't very descriptive. but it has been completely disabled since that point.
AFAICT legal finally got back to us and said
yea you just need a LICENSE file, stuff on each file never had any legal impact
(aside from cases where you need to carry along attribution/etc).
so it was just legal-cargo-culting all along.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, just wondering what the deal is with the license gen helper, we don't need it?
also there's some check stuff failing, but unsure what the deal was there |
required changing a couple mocks and regenerating a bit, but nothing major Signed-off-by: Steven L <[email protected]>
Signed-off-by: Steven L <[email protected]>
Signed-off-by: Steven L <[email protected]>
Signed-off-by: Steven L <[email protected]>
Signed-off-by: Steven L <[email protected]>
After much yamling of files, Go 1.24 support is ready!
This is the non-WIP version of #7111 which got kicked off due to #7093 (but it does not contain those changes, this is just roughly the minimum needed for 1.24).
Library changes
This migrates a relative few mocks to
github.com/vektra/mockery/v3
, becausev2
doesn't support Go 1.24+.The good news is that it's MUCH faster now, and more flexible, though only for a few types.
If vektra/mockery#1030 gets accepted, we could do the same for our
go.uber.org/mock
mocks, but currently the license is questionable in the fork (for CNCF purposes) and the changes are non-trivial. So getting mockery to accept it (which might involve go.uber.org/mock accepting it) is likely the best route, for a variety of reasons.go.uber.org/mock
's upgrade seems mostly harmless and I was hoping it'd solve some of the test failures (it did not), so I've just left it in. Unfortunately it actually makes mock-codegen worse, ~1 arg per mock function on some types is renamed from something useful toarg0
orarg4
(position varies). I have no idea why that happens, but it doesn't seem too critical to maintain, and it's stable so it's not a codegen concern.github.com/ncruces/go-sqlite3
has a minimal upgrade to support go 1.24, as we were getting segfaults and wasm panics without the upgrade. We could upgrade it to latest, but I'm holding off on that for the moment because it might be harder to achieve in our monorepo :| (apologies to OSS folks)