diff --git a/.golangci.yml b/.golangci.yml index f994412..050db11 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -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 @@ -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: @@ -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 @@ -130,6 +121,7 @@ linters: disable-all: true fast: false enable: + - tagliatelle - gocritic - gofmt - revive diff --git a/api/api.go b/api/api.go index fd5d227..ae48d8c 100644 --- a/api/api.go +++ b/api/api.go @@ -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]) } diff --git a/cmd/faucetd/main.go b/cmd/faucetd/main.go index a641939..73189d7 100644 --- a/cmd/faucetd/main.go +++ b/cmd/faucetd/main.go @@ -48,7 +48,7 @@ var ( } walletRecoveryPhrase := os.Getenv("FAUCETD_WALLET_SEED") - if len(walletRecoveryPhrase) == 0 { + if walletRecoveryPhrase == "" { log.Fatalln("FAUCETD_WALLET_SEED not set") } @@ -192,7 +192,7 @@ var ( } walletRecoveryPhrase := os.Getenv("FAUCETD_WALLET_SEED") - if len(walletRecoveryPhrase) == 0 { + if walletRecoveryPhrase == "" { log.Fatalln("FAUCETD_WALLET_SEED not set") } diff --git a/internal/test/miner_test.go b/internal/test/miner_test.go index ad2a192..2958b5e 100644 --- a/internal/test/miner_test.go +++ b/internal/test/miner_test.go @@ -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() }