diff --git a/.golangci.yml b/.golangci.yml index 594952bf19..19a9ce33b0 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -40,8 +40,9 @@ linters: - copyloopvar - errchkjson - errorlint - - fatcontext + - tenv - wastedassign + - fatcontext issues: exclude-dirs: diff --git a/server/util_test.go b/server/util_test.go index 02931b6183..a3fb9f0609 100644 --- a/server/util_test.go +++ b/server/util_test.go @@ -206,11 +206,7 @@ func TestInterceptConfigsPreRunHandlerReadsEnvVars(t *testing.T) { basename = strings.ReplaceAll(basename, ".", "_") // This is added by tendermint envVarName := fmt.Sprintf("%s_RPC_LADDR", strings.ToUpper(basename)) - os.Setenv(envVarName, testAddr) - t.Cleanup(func() { - os.Unsetenv(envVarName) - }) - + t.Setenv(envVarName, testAddr) cmd.PreRunE = preRunETestImpl serverCtx := &Context{} diff --git a/types/decimal.go b/types/decimal.go index 8be1f3820f..e7ab884b28 100644 --- a/types/decimal.go +++ b/types/decimal.go @@ -671,7 +671,11 @@ var nilJSON []byte func init() { empty := new(big.Int) bz, _ := empty.MarshalText() - nilJSON, _ = json.Marshal(string(bz)) + var err error + nilJSON, err = json.Marshal(string(bz)) + if err != nil { + panic(err) + } } // MarshalJSON marshals the decimal diff --git a/x/gov/types/vote.go b/x/gov/types/vote.go index e414315cc0..e722bced7b 100644 --- a/x/gov/types/vote.go +++ b/x/gov/types/vote.go @@ -62,7 +62,10 @@ func NewNonSplitVoteOption(option VoteOption) WeightedVoteOptions { } func (v WeightedVoteOption) String() string { - out, _ := json.Marshal(v) + out, err := json.Marshal(v) + if err != nil { + panic(err) + } return string(out) }