Skip to content
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: upgrade staticcheck, fix new linter warnings #21957

Merged
merged 2 commits into from
Jul 28, 2021

Conversation

danxmoran
Copy link
Contributor

Noticed while messing around with the build, the latest version of staticcheck is more module-/cgo-aware and comes with more checks. Bumping the version revealed one style nitpick and one outright bug.

@@ -351,8 +351,7 @@ func (e *Executor) recover(query *influxql.Query, results chan *Result) {

if willCrash {
e.log.Error("\n\n=====\nAll goroutines now follow:")
buf := debug.Stack()
e.log.Error(fmt.Sprintf("%s", buf))
e.log.Error(string(debug.Stack()))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style nitpick

@@ -499,7 +499,7 @@ type Stats struct {
NTags int
}

func (s Stats) Update(o Stats) {
func (s Stats) Update(o Stats) Stats {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: This method does a lot of updates to the fields of s, but since it wasn't being passed as a reference none of the updates were having an effect. I decided to keep the pass-by-value here and return the new data because at the callsite s is a member of a map, so getting a reference to it is a pain.

Copy link
Contributor

@davidby-influx davidby-influx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@danxmoran danxmoran merged commit 5d84c60 into master Jul 28, 2021
@danxmoran danxmoran deleted the dm-upgrade-staticcheck branch July 28, 2021 00:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants