-
Notifications
You must be signed in to change notification settings - Fork 20
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
[#310] upgrade to latest golangci-lint and enable new linters #311
Conversation
1e014dc
to
3de9e13
Compare
This problem has been fixed in go 1.22: https://go.dev/blog/loopvar-preview
cabe2cd
to
4621fbb
Compare
In most cases we would rather use assert.Error so that the test keeps going and gives us more information. This linter doesn't seem to be valuable enough to enforce.
See warnings like: level=warning msg="[config_reader] The output format `github-actions` is deprecated, please use `colored-line-number`"
@@ -292,10 +292,10 @@ func (c *Checker) replaceChunk(chunk *table.Chunk) error { | |||
c.recopyLock.Lock() | |||
defer c.recopyLock.Unlock() | |||
|
|||
if _, err := dbconn.RetryableTransaction(context.TODO(), c.db, false, dbconn.NewDBConfig(), deleteStmt); err != nil { | |||
if _, err := dbconn.RetryableTransaction(ctx, c.db, false, dbconn.NewDBConfig(), deleteStmt); err != nil { |
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.
Hope there's no unintended side effects here. I don't think this is a problem but want to highlight this change. It's to satisfy the contextcheck
linter.
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.
It looks good to me. I think this is a code improvement.
@@ -2368,7 +2368,7 @@ func TestSkipDropAfterCutover(t *testing.T) { | |||
var tableCount int | |||
err = m.db.QueryRow(sql).Scan(&tableCount) | |||
assert.NoError(t, err) | |||
assert.Equal(t, tableCount, 1) | |||
assert.Equal(t, 1, tableCount) |
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.
To fix testifylint: expected-actual
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 look good to me. No issues.
@@ -292,10 +292,10 @@ func (c *Checker) replaceChunk(chunk *table.Chunk) error { | |||
c.recopyLock.Lock() | |||
defer c.recopyLock.Unlock() | |||
|
|||
if _, err := dbconn.RetryableTransaction(context.TODO(), c.db, false, dbconn.NewDBConfig(), deleteStmt); err != nil { | |||
if _, err := dbconn.RetryableTransaction(ctx, c.db, false, dbconn.NewDBConfig(), deleteStmt); err != nil { |
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.
It looks good to me. I think this is a code improvement.
There's a degree of subjectivity to linting. Each commit represents an atomic decision and is open to change/discussion. Please refer to the commit in question if you'd like to discuss/change any decision.
Resolves #310