Skip to content

Commit

Permalink
Apply errchkjson, tenv
Browse files Browse the repository at this point in the history
  • Loading branch information
tkxkd0159 committed Jun 12, 2024
1 parent 5af53fa commit e24fc0f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
3 changes: 2 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ linters:
- copyloopvar
- errchkjson
- errorlint
- fatcontext
- tenv
- wastedassign
- fatcontext

issues:
exclude-dirs:
Expand Down
6 changes: 1 addition & 5 deletions server/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down
6 changes: 5 additions & 1 deletion types/decimal.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Check warning on line 677 in types/decimal.go

View check run for this annotation

Codecov / codecov/patch

types/decimal.go#L677

Added line #L677 was not covered by tests
}
}

// MarshalJSON marshals the decimal
Expand Down
5 changes: 4 additions & 1 deletion x/gov/types/vote.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Check warning on line 67 in x/gov/types/vote.go

View check run for this annotation

Codecov / codecov/patch

x/gov/types/vote.go#L67

Added line #L67 was not covered by tests
}
return string(out)
}

Expand Down

0 comments on commit e24fc0f

Please sign in to comment.