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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion build/ci.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,15 @@ func doLint(cmdline []string) {
build.MustRunCommand(filepath.Join(GOBIN, "gometalinter.v1"), "--install")

// Run fast linters batched together
configs := []string{"--vendor", "--disable-all", "--enable=vet", "--enable=gofmt", "--enable=misspell"}
configs := []string{
"--vendor",
"--disable-all",
"--enable=vet",
"--enable=gofmt",
"--enable=misspell",
"--enable=goconst",
"--min-occurrences=6", // for goconst
}
build.MustRunCommand(filepath.Join(GOBIN, "gometalinter.v1"), append(configs, packages...)...)

// Run slow linters one by one
Expand Down
8 changes: 5 additions & 3 deletions cmd/swarm/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ import (
"gopkg.in/urfave/cli.v1"
)

const bzzManifestJSON = "application/bzz-manifest+json"

func add(ctx *cli.Context) {
args := ctx.Args()
if len(args) < 3 {
Expand Down Expand Up @@ -145,7 +147,7 @@ func addEntryToManifest(ctx *cli.Context, mhash, path, hash, ctype string) strin
if path == entry.Path {
utils.Fatalf("Path %s already present, not adding anything", path)
} else {
if entry.ContentType == "application/bzz-manifest+json" {
if entry.ContentType == bzzManifestJSON {
prfxlen := strings.HasPrefix(path, entry.Path)
if prfxlen && len(path) > len(longestPathEntry.Path) {
longestPathEntry = entry
Expand Down Expand Up @@ -207,7 +209,7 @@ func updateEntryInManifest(ctx *cli.Context, mhash, path, hash, ctype string) st
if path == entry.Path {
newEntry = entry
} else {
if entry.ContentType == "application/bzz-manifest+json" {
if entry.ContentType == bzzManifestJSON {
prfxlen := strings.HasPrefix(path, entry.Path)
if prfxlen && len(path) > len(longestPathEntry.Path) {
longestPathEntry = entry
Expand Down Expand Up @@ -281,7 +283,7 @@ func removeEntryFromManifest(ctx *cli.Context, mhash, path string) string {
if path == entry.Path {
entryToRemove = entry
} else {
if entry.ContentType == "application/bzz-manifest+json" {
if entry.ContentType == bzzManifestJSON {
prfxlen := strings.HasPrefix(path, entry.Path)
if prfxlen && len(path) > len(longestPathEntry.Path) {
longestPathEntry = entry
Expand Down