Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Go 1.21 update list #3089

Open
roman-khimov opened this issue Aug 16, 2023 · 5 comments
Open

Go 1.21 update list #3089

roman-khimov opened this issue Aug 16, 2023 · 5 comments
Labels
blocked Can't be done because of something enhancement Improving existing functionality go Go language related I4 No visible changes S2 Regular significance U4 Nothing urgent

Comments

@roman-khimov
Copy link
Member

It's an experimental format, usually I've created an issue for specific language update related topic, but we have huge number of Go repositories and replicating these issues into all of them isn't practical, replicating one issue is more feasible. And most of the time they're solved all at once.

So, when we're to drop support for 1.20, the following things should be done:

  • use min()/max() where appropriate
    It's not easy to identify all cases where it's applicable, but there are likely some and we can search a bit for them. We also have some time before 1.20 is out, so leave comments if you notice something in the code
  • use clear() to reset maps
    We certainly have cases where a new map is created and old one is forgotten, because dropping elements one by one is no fun. Now we can clear() and reuse old maps which is supposed to be more efficient. Also add a comment if there are some known places in the code for it.
  • replace slice.Clean() with clear()
  • replace slice.Reverse() with slices.Reverse()
  • drop util/slice completely
  • use slices.BinarySearch() and slices.BinarySearchFunc()
    We have a number of places with sort.Search(), likely they can be improved
  • use slices.Compact() where applicable
    PublicKeys.Unique() or other deduplication cases.
  • use slices.Sort() instead of sort.Slice where applicable
  • use other slices functions where applicable
  • use maps package where applicable
    This doesn't seem to be as useful as slices, but some use cases can probably be found
  • use bytes.AvailableBuffer()
    Some serialization code likely can be improved with it.
  • check that we don't use any deprecated crypto/elliptic things
  • consider using errors.ErrUnsupported where applicable
  • use sync.OnceFunc (we have cases like that) and OnceValue(s) (maybe)
@roman-khimov
Copy link
Member Author

clear() -> (mp *Pool) RemoveStale

@roman-khimov
Copy link
Member Author

clear() -> (t *Trie) Collapse

@roman-khimov
Copy link
Member Author

slices.BinarySearch is limited to https://pkg.go.dev/cmp#Ordered, likely not very useful for us now.

@carpawell
Copy link
Member

BTW, some new built-in funcs may have their experimental analogues like golang.org/x/exp/maps -> clear/maps.clear. I used some of them while was not able to use not released yet funcs. Just a reminder for an ansigneee.

@roman-khimov roman-khimov added U4 Nothing urgent enhancement Improving existing functionality S2 Regular significance I4 No visible changes and removed refactoring labels Dec 21, 2023
@roman-khimov roman-khimov added the blocked Can't be done because of something label Dec 21, 2023
@AnnaShaleva
Copy link
Member

We need to update github.com/consensys/gnark from 0.9.1 to 0.10.0 along with this change since v0.10.0 requires at least Go 1.21.

AnnaShaleva added a commit that referenced this issue May 1, 2024
This reverts commit 874ed1a.
We can't allow this gnark update since minimum required Go version for
NeoGo and all examples is 1.20. It will be done as a part of #3089.
AnnaShaleva added a commit that referenced this issue May 1, 2024
This reverts commit 874ed1a.
We can't allow this gnark update since minimum required Go version for
NeoGo and all examples is 1.20. It will be done as a part of #3089.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Can't be done because of something enhancement Improving existing functionality go Go language related I4 No visible changes S2 Regular significance U4 Nothing urgent
Projects
None yet
Development

No branches or pull requests

3 participants