fiximports script

This commit is contained in:
Łukasz Magiera 2022-06-14 16:39:10 +02:00
parent 016749b60b
commit d929d7104f
2 changed files with 19 additions and 1 deletions

View File

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

15
scripts/fiximports Executable file
View File

@ -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" '{}'