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:
Roman Khimov 2019-08-12 18:08:39 +03:00
parent 4e40467dc3
commit f445103260

View file

@ -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
} }