From db122de1975d35d6637ba19f24fd91e08a75eb68 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Fri, 15 Jan 2021 21:06:35 +0300 Subject: [PATCH] storage: fix linter warnings pkg/core/interop/storage/find.go:19:6: exported type Iterator should have comment or be unexported pkg/core/interop/storage/find.go:25:1: exported function NewIterator should have comment or be unexported pkg/core/interop/storage/find.go:33:1: exported method Iterator.Next should have comment or be unexported pkg/core/interop/storage/find.go:35:3: should replace s.index += 1 with s.index++ pkg/core/interop/storage/find.go:40:1: exported method Iterator.Value should have comment or be unexported --- pkg/core/interop/storage/find.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/core/interop/storage/find.go b/pkg/core/interop/storage/find.go index 50fd1af92..a3b30cea9 100644 --- a/pkg/core/interop/storage/find.go +++ b/pkg/core/interop/storage/find.go @@ -16,12 +16,14 @@ const ( FindDeserialize | FindPick0 | FindPick1 ) +// Iterator is an iterator state representation. type Iterator struct { m []stackitem.MapElement opts int64 index int } +// NewIterator creates a new Iterator with given options for a given map. func NewIterator(m *stackitem.Map, opts int64) *Iterator { return &Iterator{ m: m.Value().([]stackitem.MapElement), @@ -30,13 +32,17 @@ func NewIterator(m *stackitem.Map, opts int64) *Iterator { } } +// Next advances the iterator and returns true if Value can be called at the +// current position. func (s *Iterator) Next() bool { if s.index < len(s.m) { - s.index += 1 + s.index++ } return s.index < len(s.m) } +// Value returns current iterators value (exact type depends on options this +// iterator was created with). func (s *Iterator) Value() stackitem.Item { key := s.m[s.index].Key.Value().([]byte) if s.opts&FindRemovePrefix != 0 {