Skip to content

Commit

Permalink
fix shadow var
Browse files Browse the repository at this point in the history
  • Loading branch information
yihuang committed Oct 23, 2023
1 parent c74ba3b commit 7680cdd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions types/chain_id.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ const ChainIDFieldName = "chain_id"
func ParseChainIDFromGenesis(reader io.Reader) (string, error) {
decoder := jstream.NewDecoder(reader, 1).EmitKV()
var (
chain_id string
ok bool
chain_id string
chain_id_ok bool
)
err := decoder.Decode(func(mv *jstream.MetaValue) bool {
if kv, ok := mv.Value.(jstream.KV); ok {
if kv.Key == ChainIDFieldName {
chain_id, ok = kv.Value.(string)
chain_id, chain_id_ok = kv.Value.(string)
return false
}
}
Expand All @@ -30,7 +30,7 @@ func ParseChainIDFromGenesis(reader io.Reader) (string, error) {
if len(chain_id) > 0 {
return chain_id, nil
}
if !ok {
if !chain_id_ok {
return "", errors.New("chain-id is not a string")
}
if err == nil {
Expand Down

0 comments on commit 7680cdd

Please sign in to comment.