Skip to content

Commit d929d71

Browse files
committed
fiximports script
1 parent 016749b commit d929d71

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,10 @@ docsgen-openrpc-gateway: docsgen-openrpc-bin
349349

350350
.PHONY: docsgen docsgen-md-bin docsgen-openrpc-bin
351351

352-
gen: actors-gen type-gen method-gen cfgdoc-gen docsgen api-gen circleci bundle-gen
352+
fiximports:
353+
./scripts/fiximports
354+
355+
gen: actors-gen type-gen method-gen cfgdoc-gen docsgen api-gen circleci bundle-gen fiximports
353356
@echo ">>> IF YOU'VE MODIFIED THE CLI OR CONFIG, REMEMBER TO ALSO MAKE docsgen-cli"
354357
.PHONY: gen
355358

scripts/fiximports

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env bash
2+
3+
go_files() {
4+
find . -type f -name \*.go -not -name \*_cbor_gen.go | grep -v './extern/filecoin-ffi' | grep -v './extern/test-vectors'
5+
}
6+
7+
go_files | xargs -I '{}' sed -i -e '/import (/ {
8+
:1
9+
$!N
10+
s/\n\n/\'$'\n''/
11+
/)/!b1
12+
}' '{}'
13+
14+
go_files | xargs -I '{}' goimports -w -local "github.com/filecoin-project" '{}'
15+
go_files | xargs -I '{}' goimports -w -local "github.com/filecoin-project/lotus" '{}'

0 commit comments

Comments
 (0)