mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-30 09:33:36 +00:00
pkg/vm/stack: fix S1002 gosimple warnings in map.go
S1002: should omit comparison to bool constant, can be simplified to ok.Value() (from gosimple)
This commit is contained in:
parent
4e40467dc3
commit
f445103260
1 changed files with 4 additions and 4 deletions
|
@ -43,7 +43,7 @@ func (m *Map) ContainsKey(key Item) (*Boolean, error) {
|
||||||
for k := range m.Value() {
|
for k := range m.Value() {
|
||||||
if ok, err := CompareHash(k, key); err != nil {
|
if ok, err := CompareHash(k, key); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else if ok.Value() == true {
|
} else if ok.Value() {
|
||||||
return ok, nil
|
return ok, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ func (m *Map) Remove(key Item) error {
|
||||||
for k := range m.Value() {
|
for k := range m.Value() {
|
||||||
if ok, err := CompareHash(k, key); err != nil {
|
if ok, err := CompareHash(k, key); err != nil {
|
||||||
return err
|
return err
|
||||||
} else if ok.Value() == true {
|
} else if ok.Value() {
|
||||||
d = k
|
d = k
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ func (m *Map) Add(key Item, value Item) error {
|
||||||
for k := range m.Value() {
|
for k := range m.Value() {
|
||||||
if ok, err := CompareHash(k, key); err != nil {
|
if ok, err := CompareHash(k, key); err != nil {
|
||||||
return err
|
return err
|
||||||
} else if ok.Value() == true {
|
} else if ok.Value() {
|
||||||
return errors.New("try to insert duplicate key! ")
|
return errors.New("try to insert duplicate key! ")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ func (m *Map) ValueOfKey(key Item) (Item, error) {
|
||||||
for k, v := range m.Value() {
|
for k, v := range m.Value() {
|
||||||
if ok, err := CompareHash(k, key); err != nil {
|
if ok, err := CompareHash(k, key); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else if ok.Value() == true {
|
} else if ok.Value() {
|
||||||
return v, nil
|
return v, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue