-
Notifications
You must be signed in to change notification settings - Fork 837
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
build/ci: Update Go to v1.24, golangci-lint to v1.64.5 and fix issues #1804
Conversation
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.
Copilot reviewed 90 out of 105 changed files in this pull request and generated 1 comment.
Files not reviewed (15)
- .github/workflows/arm64.Dockerfile: Language not supported
- Dockerfile: Language not supported
- Makefile: Language not supported
- backtester/btrpc/btrpc.swagger.json: Language not supported
- cmd/gctcli/data_history.go: Evaluated as low risk
- backtester/data/kline/kline.go: Evaluated as low risk
- backtester/btrpc/btrpc.proto: Evaluated as low risk
- backtester/engine/setup.go: Evaluated as low risk
- cmd/gen_sqlboiler_config/main.go: Evaluated as low risk
- .github/workflows/linter.yml: Evaluated as low risk
- backtester/engine/grpcserver_test.go: Evaluated as low risk
- .github/workflows/proto-lint.yml: Evaluated as low risk
- backtester/btrpc/btrpc_grpc.pb.go: Evaluated as low risk
- backtester/engine/grpcserver.go: Evaluated as low risk
- .github/workflows/tests.yml: Evaluated as low risk
Comments suppressed due to low confidence (2)
backtester/config/strategyconfigbuilder/main.go:432
- Ensure that the port value is correctly handled as uint32 throughout the codebase to avoid potential overflow issues.
port, err = strconv.ParseUint(input, 10, 32)
backtester/config/strategyconfigbuilder/main.go:437
- [nitpick] The comment
//nolint:gosec // No overflow risk
needs to be justified better. Ensure that there is indeed no overflow risk.
cfg.DataSettings.DatabaseData.Config.Port = uint32(port) //nolint:gosec // No overflow risk
backtester/btcli/commands.go
Outdated
@@ -118,16 +119,19 @@ func executeStrategyFromFile(c *cli.Context) error { | |||
} | |||
} | |||
|
|||
var intervalOverride uint64 | |||
var intervalOverride int64 |
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.
Add a check to ensure intervalOverride is not negative before converting it to time.Duration.
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
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.
Good stuff! nothing major I could see.
cdba415
to
27b8e73
Compare
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.
tACK tested old config encryption to this from master 🚀
27b8e73
to
311c8a8
Compare
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.
Looks good 👍
Only nits, and a few pedantic suggestions.
9c98fb6
to
dee6f63
Compare
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.
Looks good to me 👍
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.
One suggestion changes look good.
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.
That was a slog. Only thing that really stood out was usetesting
being commented out
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.
tACK new changes. 🚀
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.
tACK!
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 🎉
config/config_encryption.go
Outdated
totalLen := len(encryptionPrefix) + len(c.storedSalt) + len(encryptionVersionPrefix) + versionSize + len(ciphertext) | ||
appendedFile := make([]byte, totalLen) |
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'm easy, but arguably:
totalLen := len(encryptionPrefix) + len(c.storedSalt) + len(encryptionVersionPrefix) + versionSize + len(ciphertext) | |
appendedFile := make([]byte, totalLen) | |
appendedFile := make([]byte, len(encryptionPrefix) + len(c.storedSalt) + len(encryptionVersionPrefix) + versionSize + len(ciphertext)) |
For me, it's very implicit that the maths there amounts to "total length"
engine/engine_test.go
Outdated
assert.NotEmpty(t, defaultCfg.Name) | ||
assert.True(t, defaultCfg.Enabled) |
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 think that when you're not testing the overall thing, you have to add context for the error.
That is: require.NotEmpty(t, defaultCfg)
is fine, because it's about the unit test's target func main return value.
assert.NotEmpty(t, defaultCfg.Name) | |
assert.True(t, defaultCfg.Enabled) | |
assert.NotEmpty(t, defaultCfg.Name, "Name should not be empty") | |
assert.True(t, defaultCfg.Enabled, "Enabled should have correct value") |
This PR is pending release of sonic's next release: bytedance/sonic#741 (comment) which should land next week |
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.
Only Nits.
t.Errorf("received '%v' expected '%v'", resp, nil) | ||
} | ||
assert.ErrorIs(t, err, common.ErrNilPointer) | ||
assert.Nil(t, resp) |
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.
🦟 Don't think we should need to check what resp is when err is not nil 🙂
assert.Nil(t, resp) |
h = new(dollarcostaverage.Strategy) | ||
resp, err = createNewStrategy(dollarcostaverage.Name, true, h) | ||
assert.NoError(t, err, "createNewStrategy should not error") | ||
assert.NotNil(t, resp) |
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.
🦟 Nit:
assert.NotNil(t, resp) | |
assert.NotSame(t, h, resp, "createNewStrategy must return a new pointer") |
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.
Just something I noticed on new changes. Thanks!
engine/engine_test.go
Outdated
assert.Positive(t, defaultCfg.WebsocketResponseCheckTimeout, 0) | ||
assert.Positive(t, defaultCfg.WebsocketResponseMaxLimit, 0) | ||
assert.Positive(t, defaultCfg.WebsocketTrafficTimeout, 0) |
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.
assert.Positive(t, defaultCfg.WebsocketResponseCheckTimeout, 0) | |
assert.Positive(t, defaultCfg.WebsocketResponseMaxLimit, 0) | |
assert.Positive(t, defaultCfg.WebsocketTrafficTimeout, 0) | |
assert.Positive(t, defaultCfg.WebsocketResponseCheckTimeout) | |
assert.Positive(t, defaultCfg.WebsocketResponseMaxLimit) | |
assert.Positive(t, defaultCfg.WebsocketTrafficTimeout) |
…1 and golangci-lint v1.64.6 Also addresses nits
070e09e
to
39e5479
Compare
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 🎉
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.
Lovely, thanks!
PR Description
Bumps Go to v1.24, golangci-lint to v1.64.5 and fixes the issues it found.
Summary of changes:
for i := 0; i < b.N; i++
loops and suggested to use a range as is standard now, however I opted instead to use b.Loop() which is new in Go1.24.kline.CalculateCandleDateRanges
had a potential divide by 0 panic bug if limit was set to 0.Type of change
How has this been tested
Checklist