Skip to content

Commit 4f4dac9

Browse files
committed
chore: fix all golangci-lint staticcheck issues
align kubo with unified golang ci linter from IPDX and rules used in boxo and other go packages addressed lint rules: - ST1000: added package comments - ST1020, ST1021, ST1022: fixed function/method comments - QF1001: applied De Morgan's law - QF1003: converted if-else chains to tagged switches - QF1004: replaced strings.Replace with strings.ReplaceAll - QF1008: simplified embedded struct field selectors - unconvert: removed unnecessary type conversions - usestdlibvars: used stdlib constants instead of literals disabled errcheck linter in .golangci.yml
1 parent dad310a commit 4f4dac9

File tree

97 files changed

+199
-142
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+199
-142
lines changed

.golangci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ linters:
33
default: standard
44
enable:
55
- staticcheck
6+
- unconvert
7+
- usestdlibvars
8+
disable:
9+
- errcheck
610
settings:
711
staticcheck:
812
checks:

assets/assets.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Package assets provides embedded asset files for kubo.
12
package assets
23

34
import (

client/rpc/api.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Package rpc provides an RPC client implementation for the kubo HTTP API.
12
package rpc
23

34
import (

client/rpc/api_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ func Test_NewURLApiWithClient_With_Headers(t *testing.T) {
111111
http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
112112
val := r.Header.Get(headerToTest)
113113
if val != expectedHeaderValue {
114-
w.WriteHeader(400)
114+
w.WriteHeader(http.StatusBadRequest)
115115
return
116116
}
117117
http.ServeContent(w, r, "", time.Now(), strings.NewReader("test"))

client/rpc/auth/auth.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Package auth provides HTTP authentication utilities for the RPC client.
12
package auth
23

34
import "net/http"

client/rpc/response.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ func (r *Response) decode(dec interface{}) error {
8080

8181
func (r *Request) Send(c *http.Client) (*Response, error) {
8282
url := r.getURL()
83-
req, err := http.NewRequest("POST", url, r.Body)
83+
req, err := http.NewRequest(http.MethodPost, url, r.Body)
8484
if err != nil {
8585
return nil, err
8686
}

cmd/ipfs/kubo/daemon.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,9 +323,10 @@ func daemonFunc(req *cmds.Request, re cmds.ResponseEmitter, env cmds.Environment
323323
}
324324
defer fetcher.Close()
325325

326-
if migrationCfg.Keep == "cache" {
326+
switch migrationCfg.Keep {
327+
case "cache":
327328
cacheMigrations = true
328-
} else if migrationCfg.Keep == "pin" {
329+
case "pin":
329330
pinMigrations = true
330331
}
331332

cmd/ipfs/kubo/start.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// cmd/ipfs/kubo implements the primary CLI binary for kubo
1+
// Package kubo implements the primary CLI binary for kubo
22
package kubo
33

44
import (

cmd/ipfs/util/signal.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//go:build !wasm
22
// +build !wasm
33

4+
// Package util provides utility functions for the IPFS CLI.
45
package util
56

67
import (

commands/context.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Package commands implements IPFS commands.
12
package commands
23

34
import (

0 commit comments

Comments
 (0)