Last active
April 8, 2024 02:13
-
-
Save hidetatz/7145b4d2ffddbda4ea00ff4cc50e2852 to your computer and use it in GitHub Desktop.
How to build generics-aware goimports as of 2021/12/07
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# In this script I'll use gotip, but there might be other ways | |
go install golang.org/dl/gotip@latest | |
# golang/go HEAD will be built | |
gotip download | |
# make sure gotip is available | |
gotip version | |
git clone https://github.com/golang/tools | |
cd tools | |
gotip install ./cmd/goimports/ | |
# Now ~/go/bin/goimports (or somewhere else) can format Go code using generics! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For anyone looking for generics-aware gopls, this can help: https://github.com/golang/tools/blob/master/gopls/doc/advanced.md#working-with-generic-code