lotus/scripts/fiximports

18 lines
480 B
Plaintext
Raw Permalink Normal View History

2022-06-14 14:39:10 +00:00
#!/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.ifixbak -e '/import (/ {
2022-06-14 14:39:10 +00:00
:1
$!N
s/\n\n/\'$'\n''/
/)/!b1
}' '{}'
find . -type f -name \*.go.ifixbak | xargs rm
2022-06-14 14:39:10 +00:00
go_files | xargs -I '{}' goimports -w -local "github.com/filecoin-project" '{}'
go_files | xargs -I '{}' goimports -w -local "github.com/filecoin-project/lotus" '{}'