-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
golangci-lint not working correctly #2987
Conversation
@@ -76,7 +76,7 @@ func TestLastValueUpdate(t *testing.T) { | |||
|
|||
var last number.Number | |||
for i := 0; i < count; i++ { | |||
x := profile.Random(rand.Intn(1)*2 - 1) | |||
x := profile.Random(rand.Intn(2)*2 - 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.
This doesn't feel right. What's the lint error being raised here and why is this the approach taken to fix 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.
The lint error is
aggregator/lastvalue/lastvalue_test.go:79:24: SA4030: math/rand.Intn(n) generates a random value 0 <= x < n; that is, the generated values don't include n; rand.Intn(1) therefore always returns 0 (staticcheck)
x := profile.Random(rand.Intn(1)*2 - 1)
^
As my first comment says , As a freshman for metric, I'm not sure this changes is correctly. pls make some advice directly.
Codecov Report
@@ Coverage Diff @@
## main #2987 +/- ##
=====================================
Coverage 75.7% 75.7%
=====================================
Files 177 177
Lines 11813 11813
=====================================
+ Hits 8943 8945 +2
+ Misses 2636 2634 -2
Partials 234 234
|
|
This looks to have been resolve a while ago as far as I can tell. We are currently at version 1.50.1 of golangci-lint: #3404 Closing as this looks superseded. Please reopen if this was in error. |
There's two main changes
go.mod
. because dependabot is not able to update non-semver dependency.golangci-lint
version to fix some linters not working correctly. Some linters not working correctly on versionv1.45.3-0.20220330010013-d2ccc6d2bbbb
, I don't why, but after upgrade, it works.Additionally
As a freshman for metric, i'm not sure this changes is correctly for fix linter on
sdk/metric/aggregator/lastvalue/lastvalue_test.go:79
Related link:
blizzy78/varnamelen#13 (comment)
#2761