diff --git a/Makefile b/Makefile index e681436df..572de5f4b 100644 --- a/Makefile +++ b/Makefile @@ -349,7 +349,10 @@ docsgen-openrpc-gateway: docsgen-openrpc-bin .PHONY: docsgen docsgen-md-bin docsgen-openrpc-bin -gen: actors-gen type-gen method-gen cfgdoc-gen docsgen api-gen circleci bundle-gen +fiximports: + ./scripts/fiximports + +gen: actors-gen type-gen method-gen cfgdoc-gen docsgen api-gen circleci bundle-gen fiximports @echo ">>> IF YOU'VE MODIFIED THE CLI OR CONFIG, REMEMBER TO ALSO MAKE docsgen-cli" .PHONY: gen diff --git a/scripts/fiximports b/scripts/fiximports new file mode 100755 index 000000000..464c819b8 --- /dev/null +++ b/scripts/fiximports @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +go_files() { + find . -type f -name \*.go -not -name \*_cbor_gen.go | grep -v './extern/filecoin-ffi' | grep -v './extern/test-vectors' +} + +go_files | xargs -I '{}' sed -i -e '/import (/ { + :1 + $!N + s/\n\n/\'$'\n''/ + /)/!b1 +}' '{}' + +go_files | xargs -I '{}' goimports -w -local "github.com/filecoin-project" '{}' +go_files | xargs -I '{}' goimports -w -local "github.com/filecoin-project/lotus" '{}'