-
Notifications
You must be signed in to change notification settings - Fork 20.4k
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
metalinter: address goconst warnings #15566
Conversation
build/ci.go
Outdated
configs := []string{"--vendor", "--disable-all", "--enable=vet", "--enable=gofmt", "--enable=misspell"} | ||
configs := []string{ | ||
"--vendor", | ||
"--deadline=10m", |
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.
Please don't expand the fast linters' runtime. Anything that takes a lot of time to run should be placed below in the slow linter section beside unconvert.
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.
oops, that was a vestige of running it in a low memory environment. fixed
57e2744
to
2424028
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, will merge when green. Thanks!
internal/build/env.go
Outdated
const ( | ||
travisTrue = "true" | ||
appveyorTrue = "True" | ||
) |
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.
IMHO this change is not an improvement.
node/config.go
Outdated
@@ -41,6 +41,9 @@ const ( | |||
datadirStaticNodes = "static-nodes.json" // Path within the datadir to the static node list | |||
datadirTrustedNodes = "trusted-nodes.json" // Path within the datadir to the trusted node list | |||
datadirNodeDatabase = "nodes" // Path within the datadir to store the node infos | |||
|
|||
lowerCaseGeth = "geth" | |||
upperCaseGeth = "Geth" |
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.
Neither is this.
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.
is there a better way of addressing:
internal/build/env.go:66:26:warning: 2 other occurrence(s) of "True" found in: internal/build/env.go:66:61 internal/build/env.go:75:60 (goconst)
internal/build/env.go:66:61:warning: 2 other occurrence(s) of "True" found in: internal/build/env.go:66:26 internal/build/env.go:75:60 (goconst)
internal/build/env.go:75:60:warning: 2 other occurrence(s) of "True" found in: internal/build/env.go:66:26 internal/build/env.go:66:61 (goconst)
node/config.go:219:13:warning: 2 other occurrence(s) of "geth" found in: node/config.go:263:17 node/config.go:265:16 (goconst)
node/config.go:263:17:warning: 2 other occurrence(s) of "geth" found in: node/config.go:219:13 node/config.go:265:16 (goconst)
node/config.go:265:16:warning: 2 other occurrence(s) of "geth" found in: node/config.go:219:13 node/config.go:263:17 (goconst)
?
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.
could use // nolint: goconst
but that sort of defeats the purpose IMO
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.
@karalabe may differ, but I feel goconst should not be enabled on CI because it reports things like this. We can enable ineffassign
, nakedret
, etc. because they're genuinely useful.
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.
Given that our code is generally clean, maybe I can agree with @fjl to keep this off. Perhaps reduce this PR to fixing the swarm repetition and it will be fine like that.
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 OK with adding goconst
if we raise --min-occurrences
to 6 or 7. There is value in using constants for repeated strings, but IMHO it's something that jumps in your face anyway while reviewing the code.
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 points; added the flag (which is suppoorted by metalinter itself) and reverted the code
9ce308e
to
58be787
Compare
58be787
to
c55869c
Compare
added new lines for the config array since it'll keep growing