Skip to content

Commit

Permalink
fiximports script
Browse files Browse the repository at this point in the history
  • Loading branch information
magik6k committed Jun 14, 2022
1 parent 016749b commit d929d71
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
15 changes: 15 additions & 0 deletions scripts/fiximports
Original file line number Diff line number Diff line change
@@ -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" '{}'

0 comments on commit d929d71

Please sign in to comment.