Skip to content

Commit

Permalink
all: fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
n8maninger committed Jul 22, 2024
1 parent 61995bb commit 1b5ee56
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 49 deletions.
76 changes: 34 additions & 42 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,8 @@ run:
# list of build tags, all linters use it. Default is empty list.
build-tags: []

# which dirs to skip: issues from them won't be reported;
# can use regexp here: generated.*, regexp is applied on full path;
# default value is empty list, but default dirs are skipped independently
# from this option's value (see skip-dirs-use-default).
skip-dirs:
- cover

# default is true. Enables skipping of directories:
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
skip-dirs-use-default: true

# which files to skip: they will be analyzed, but issues from them
# won't be reported. Default value is empty list, but there is
# no need to include all autogenerated files, we confidently recognize
# autogenerated files. If it's not please let us know.
skip-files: []

# output configuration options
output:
# colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
format: colored-line-number

# print lines of code with issue, default is true
print-issued-lines: true

Expand All @@ -50,34 +30,45 @@ linters-settings:
## Enabled linters:
govet:
# report about shadowed variables
check-shadowing: false
disable-all: false

golint:
min-confidence: 1.0
tagliatelle:
case:
rules:
json: goCamel
yaml: goCamel


gocritic:
# Which checks should be enabled; can't be combined with 'disabled-checks';
# See https://go-critic.github.io/overview#checks-overview
# To check which checks are enabled run `GL_DEBUG=gocritic golangci-lint run`
# By default list of stable checks is used.
enabled-checks:
- argOrder # Diagnostic options
- badCond
- caseOrder
- dupArg
- dupBranchBody
- dupCase
- dupSubExpr
- nilValReturn
- offBy1
- weakCond
- boolExprSimplify # Style options here and below.
- builtinShadow
- emptyFallthrough
- hexLiteral
- underef
- equalFold
enabled-tags:
- diagnostic
- style
disabled-checks:
# diagnostic
- appendAssign
- commentedOutCode
- uncheckedInlineErr
# style
- httpNoBody
- exitAfterDefer
- ifElseChain
- importShadow
- initClause
- nestingReduce
- octalLiteral
- paramTypeCombine
- ptrToRefParam
- stringsCompare
- tooManyResultsChecker
- typeDefFirst
- typeUnparen
- unlabelStmt
- unnamedResult
- whyNoLint
revive:
ignore-generated-header: true
rules:
Expand All @@ -100,11 +91,11 @@ linters-settings:
- name: if-return
disabled: false
- name: indent-error-flow
disabled: false
disabled: true
- name: increment-decrement
disabled: false
- name: modifies-value-receiver
disabled: false
disabled: true
- name: optimize-operands-order
disabled: false
- name: range-val-in-closure
Expand All @@ -130,6 +121,7 @@ linters:
disable-all: true
fast: false
enable:
- tagliatelle
- gocritic
- gofmt
- revive
Expand Down
2 changes: 1 addition & 1 deletion api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func (a *API) handleCreateRequest(jc jape.Context) {
}

ip := jc.Request.RemoteAddr
if forwardedFor := jc.Request.Header.Get("X-Forwarded-For"); len(forwardedFor) != 0 {
if forwardedFor := jc.Request.Header.Get("X-Forwarded-For"); forwardedFor != "" {
addresses := strings.Split(forwardedFor, ",")
ip = strings.TrimSpace(addresses[0])
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/faucetd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ var (
}

walletRecoveryPhrase := os.Getenv("FAUCETD_WALLET_SEED")
if len(walletRecoveryPhrase) == 0 {
if walletRecoveryPhrase == "" {
log.Fatalln("FAUCETD_WALLET_SEED not set")
}

Expand Down Expand Up @@ -192,7 +192,7 @@ var (
}

walletRecoveryPhrase := os.Getenv("FAUCETD_WALLET_SEED")
if len(walletRecoveryPhrase) == 0 {
if walletRecoveryPhrase == "" {
log.Fatalln("FAUCETD_WALLET_SEED not set")
}

Expand Down
6 changes: 2 additions & 4 deletions internal/test/miner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,14 +238,12 @@ func TestMining(t *testing.T) {
release, err := w.FundAndSignTransaction(&txn, amount)
if err != nil {
t.Fatal(err)
}
defer release()

if err := tp.AcceptTransactionSet([]types.Transaction{txn}); err != nil {
} else if err := tp.AcceptTransactionSet([]types.Transaction{txn}); err != nil {
buf, _ := json.MarshalIndent(txn, "", " ")
t.Log(string(buf))
t.Fatalf("failed to accept transaction %v: %v", i, err)
}
release()

added[i] = txn.ID()
}
Expand Down

0 comments on commit 1b5ee56

Please sign in to comment.