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

metalinter: address goconst warnings #15566

Merged
merged 1 commit into from
Nov 30, 2017

Conversation

zramsay
Copy link
Contributor

@zramsay zramsay commented Nov 27, 2017

added new lines for the config array since it'll keep growing

build/ci.go Outdated
configs := []string{"--vendor", "--disable-all", "--enable=vet", "--enable=gofmt", "--enable=misspell"}
configs := []string{
"--vendor",
"--deadline=10m",
Copy link
Member

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.

Copy link
Contributor Author

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

Copy link
Member

@karalabe karalabe left a 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!

@karalabe karalabe added this to the 1.8.0 milestone Nov 28, 2017
const (
travisTrue = "true"
appveyorTrue = "True"
)
Copy link
Contributor

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"
Copy link
Contributor

Choose a reason for hiding this comment

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

Neither is this.

Copy link
Contributor Author

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)

?

Copy link
Contributor Author

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

Copy link
Contributor

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.

Copy link
Member

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.

Copy link
Contributor

@fjl fjl Nov 29, 2017

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.

Copy link
Contributor Author

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

@zramsay zramsay force-pushed the linter-goconst branch 3 times, most recently from 9ce308e to 58be787 Compare November 29, 2017 13:48
@fjl fjl merged commit 73067fd into ethereum:master Nov 30, 2017
@zramsay zramsay deleted the linter-goconst branch November 30, 2017 13:23
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.

3 participants