Skip to content

Commit

Permalink
Merge pull request ipfs/kubo#6140 from ipfs/fix/golangci-lint
Browse files Browse the repository at this point in the history
chore: fix a bunch of issues caught by golangci-lint

This commit was moved from ipfs/kubo@fd15c62
  • Loading branch information
Stebalien authored Mar 29, 2019
2 parents 0a211b6 + 4e58c7b commit 6b4c67e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
8 changes: 1 addition & 7 deletions gateway/core/corehttp/gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (m mockNamesys) Resolve(ctx context.Context, name string, opts ...nsopts.Re
depth = ^uint(0)
}
for strings.HasPrefix(name, "/ipns/") {
if depth <= 0 {
if depth == 0 {
return value, namesys.ErrResolveRecursion
}
depth--
Expand Down Expand Up @@ -235,9 +235,6 @@ func TestGatewayGet(t *testing.T) {
}

func TestIPNSHostnameRedirect(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

ns := mockNamesys{}
ts, api, ctx := newTestServerAndNode(t, ns)
t.Logf("test server url: %s", ts.URL)
Expand Down Expand Up @@ -326,9 +323,6 @@ func TestIPNSHostnameRedirect(t *testing.T) {
}

func TestIPNSHostnameBacklinks(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

ns := mockNamesys{}
ts, api, ctx := newTestServerAndNode(t, ns)
t.Logf("test server url: %s", ts.URL)
Expand Down
4 changes: 2 additions & 2 deletions gateway/core/corehttp/mutex_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func MutexFractionOption(path string) ServeOption {
}
if err := r.ParseForm(); err != nil {
w.WriteHeader(http.StatusBadRequest)
w.Write([]byte(err.Error()))
_, _ = w.Write([]byte(err.Error()))
return
}

Expand All @@ -33,7 +33,7 @@ func MutexFractionOption(path string) ServeOption {
fr, err := strconv.Atoi(asfr)
if err != nil {
w.WriteHeader(http.StatusBadRequest)
w.Write([]byte(err.Error()))
_, _ = w.Write([]byte(err.Error()))
return
}
log.Infof("Setting MutexProfileFraction to %d", fr)
Expand Down
4 changes: 3 additions & 1 deletion gateway/core/corehttp/option_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ func TestCheckVersionOption(t *testing.T) {
if !tc.shouldHandle {
t.Error("handler was called even though version didn't match")
} else {
io.WriteString(w, "check!")
if _, err := io.WriteString(w, "check!"); err != nil {
t.Error(err)
}
}
})

Expand Down

0 comments on commit 6b4c67e

Please sign in to comment.