Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup project imports #327

Merged
merged 5 commits into from
Jul 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,16 @@ jobs:
- run: git --no-pager diff
- run: git --no-pager diff --quiet

imports-check:
executor: golang
steps:
- install-deps
- prepare
- run: go install golang.org/x/tools/cmd/goimports
- run: scripts/fiximports
- run: git --no-pager diff
- run: git --no-pager diff --quiet

build-all:
executor: golang
steps:
Expand Down Expand Up @@ -195,4 +205,5 @@ workflows:
- mod-tidy-check
- cbor-gen-check
- docs-check
- imports-check
- build-all
5 changes: 5 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ import (
<single, empty line>
[external packages]
<single, empty line>
[other-filecoin-project packages]
<single, empty line>
[go-fil-markets packages]
)
```
Expand All @@ -79,10 +81,13 @@ import (
ipld "github.com/ipfs/go-ipld-format"
"github.com/stretchr/testify/assert"

datatransfer "github.com/filecoin-project/go-data-transfer"

"github.com/filecoin-project/go-fil-markets/filestore/file"
)
```

You can run `script/fiximports` to put all your code in the desired format
#### Comments
Comments are a communication to other developers (including your future self) to help them understand and maintain code. Good comments describe the _intent_ of the code, without repeating the procedures directly.

Expand Down
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,14 @@ docsgen: FORCE .update-modules .filecoin-build
go run ./docsgen

$(MMDs): docsgen node_modules

imports: FORCE
scripts/fiximports

cbor-gen: FORCE
go generate ./...

tidy: FORCE
go mod tidy

prepare-pr: cbor-gen tidy diagrams imports
4 changes: 2 additions & 2 deletions docsgen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import (
"io/ioutil"
"os"

"github.com/filecoin-project/go-fil-markets/retrievalmarket"
"github.com/filecoin-project/go-statemachine/fsm"

"github.com/filecoin-project/go-fil-markets/retrievalmarket"
retrievalimpl "github.com/filecoin-project/go-fil-markets/retrievalmarket/impl"
"github.com/filecoin-project/go-fil-markets/storagemarket"
storageimpl "github.com/filecoin-project/go-fil-markets/storagemarket/impl"
"github.com/filecoin-project/go-statemachine/fsm"
)

func storageDealStatusCmp(a, b fsm.StateKey) bool {
Expand Down
18 changes: 11 additions & 7 deletions pieceio/mocks/CarIO.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 9 additions & 5 deletions pieceio/mocks/PieceIO.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions pieceio/pieceio.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ import (
"os"
"sync"

"github.com/filecoin-project/go-padreader"
"github.com/filecoin-project/sector-storage/ffiwrapper"
"github.com/filecoin-project/specs-actors/actors/abi"
"github.com/ipfs/go-cid"
blockstore "github.com/ipfs/go-ipfs-blockstore"
"github.com/ipld/go-car"
"github.com/ipld/go-ipld-prime"

"github.com/filecoin-project/go-padreader"
"github.com/filecoin-project/sector-storage/ffiwrapper"
"github.com/filecoin-project/specs-actors/actors/abi"

"github.com/filecoin-project/go-fil-markets/filestore"
)

Expand Down
5 changes: 3 additions & 2 deletions pieceio/pieceio_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import (
"io"
"testing"

"github.com/filecoin-project/sector-storage/ffiwrapper"
"github.com/filecoin-project/specs-actors/actors/abi"
"github.com/ipfs/go-cid"
dag "github.com/ipfs/go-merkledag"
dstest "github.com/ipfs/go-merkledag/test"
Expand All @@ -18,6 +16,9 @@ import (
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"

"github.com/filecoin-project/sector-storage/ffiwrapper"
"github.com/filecoin-project/specs-actors/actors/abi"

"github.com/filecoin-project/go-fil-markets/filestore"
fsmocks "github.com/filecoin-project/go-fil-markets/filestore/mocks"
"github.com/filecoin-project/go-fil-markets/pieceio"
Expand Down
3 changes: 2 additions & 1 deletion pieceio/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package pieceio
import (
"io"

"github.com/filecoin-project/specs-actors/actors/abi"
blocks "github.com/ipfs/go-block-format"
"github.com/ipfs/go-cid"
"github.com/ipld/go-car"
"github.com/ipld/go-ipld-prime"

"github.com/filecoin-project/specs-actors/actors/abi"

"github.com/filecoin-project/go-fil-markets/filestore"
)

Expand Down
3 changes: 2 additions & 1 deletion piecestore/piecestore.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package piecestore

import (
"github.com/filecoin-project/go-statestore"
"github.com/ipfs/go-cid"
"github.com/ipfs/go-datastore"
"github.com/ipfs/go-datastore/namespace"

"github.com/filecoin-project/go-statestore"
)

// DSPiecePrefix is the name space for storing piece infos
Expand Down
3 changes: 2 additions & 1 deletion piecestore/piecestore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ import (
"math/rand"
"testing"

"github.com/filecoin-project/specs-actors/actors/abi"
"github.com/ipfs/go-cid"
"github.com/ipfs/go-datastore"
"github.com/stretchr/testify/assert"

"github.com/filecoin-project/specs-actors/actors/abi"

"github.com/filecoin-project/go-fil-markets/piecestore"
"github.com/filecoin-project/go-fil-markets/shared_testutil"
)
Expand Down
3 changes: 2 additions & 1 deletion piecestore/types.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package piecestore

import (
"github.com/filecoin-project/specs-actors/actors/abi"
"github.com/ipfs/go-cid"

"github.com/filecoin-project/specs-actors/actors/abi"
)

//go:generate cbor-gen-for PieceInfo DealInfo BlockLocation PieceBlockLocation CIDInfo
Expand Down
5 changes: 3 additions & 2 deletions retrievalmarket/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package retrievalmarket
import (
"context"

"github.com/filecoin-project/go-address"
"github.com/filecoin-project/specs-actors/actors/abi"
"github.com/ipfs/go-cid"
"github.com/libp2p/go-libp2p-core/peer"

"github.com/filecoin-project/go-address"
"github.com/filecoin-project/specs-actors/actors/abi"
)

// ClientSubscriber is a callback that is registered to listen for retrieval events
Expand Down
3 changes: 2 additions & 1 deletion retrievalmarket/discovery/local_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package discovery_test
import (
"testing"

specst "github.com/filecoin-project/specs-actors/support/testing"
"github.com/ipfs/go-datastore"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

specst "github.com/filecoin-project/specs-actors/support/testing"

"github.com/filecoin-project/go-fil-markets/retrievalmarket"
"github.com/filecoin-project/go-fil-markets/retrievalmarket/discovery"
"github.com/filecoin-project/go-fil-markets/shared_testutil"
Expand Down
12 changes: 6 additions & 6 deletions retrievalmarket/impl/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ import (
"context"
"errors"

"github.com/filecoin-project/go-address"
datatransfer "github.com/filecoin-project/go-data-transfer"
"github.com/filecoin-project/go-statemachine/fsm"
"github.com/filecoin-project/specs-actors/actors/abi"
"github.com/hannahhoward/go-pubsub"
"github.com/ipfs/go-cid"
"github.com/ipfs/go-datastore"
Expand All @@ -16,13 +12,17 @@ import (
"github.com/libp2p/go-libp2p-core/peer"
"golang.org/x/xerrors"

"github.com/filecoin-project/go-address"
datatransfer "github.com/filecoin-project/go-data-transfer"
"github.com/filecoin-project/go-statemachine/fsm"
"github.com/filecoin-project/go-storedcounter"
"github.com/filecoin-project/specs-actors/actors/abi"

"github.com/filecoin-project/go-fil-markets/retrievalmarket"
"github.com/filecoin-project/go-fil-markets/retrievalmarket/impl/clientstates"
"github.com/filecoin-project/go-fil-markets/retrievalmarket/impl/dtutils"
rmnet "github.com/filecoin-project/go-fil-markets/retrievalmarket/network"
"github.com/filecoin-project/go-fil-markets/shared"

"github.com/filecoin-project/go-storedcounter"
)

var log = logging.Logger("retrieval")
Expand Down
7 changes: 4 additions & 3 deletions retrievalmarket/impl/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,23 @@ import (
"errors"
"testing"

"github.com/filecoin-project/go-address"
"github.com/filecoin-project/specs-actors/actors/abi"
"github.com/ipfs/go-datastore"
dss "github.com/ipfs/go-datastore/sync"
bstore "github.com/ipfs/go-ipfs-blockstore"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-storedcounter"
"github.com/filecoin-project/specs-actors/actors/abi"

"github.com/filecoin-project/go-fil-markets/retrievalmarket"
retrievalimpl "github.com/filecoin-project/go-fil-markets/retrievalmarket/impl"
"github.com/filecoin-project/go-fil-markets/retrievalmarket/impl/testnodes"
"github.com/filecoin-project/go-fil-markets/retrievalmarket/network"
rmnet "github.com/filecoin-project/go-fil-markets/retrievalmarket/network"
tut "github.com/filecoin-project/go-fil-markets/shared_testutil"
"github.com/filecoin-project/go-storedcounter"
)

func TestClient_Construction(t *testing.T) {
Expand Down
5 changes: 3 additions & 2 deletions retrievalmarket/impl/clientstates/client_fsm.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ package clientstates
import (
"fmt"

"github.com/ipfs/go-cid"
"golang.org/x/xerrors"

"github.com/filecoin-project/go-address"
datatransfer "github.com/filecoin-project/go-data-transfer"
"github.com/filecoin-project/go-statemachine/fsm"
"github.com/filecoin-project/specs-actors/actors/abi"
"github.com/filecoin-project/specs-actors/actors/abi/big"
"github.com/ipfs/go-cid"
"golang.org/x/xerrors"

rm "github.com/filecoin-project/go-fil-markets/retrievalmarket"
)
Expand Down
3 changes: 2 additions & 1 deletion retrievalmarket/impl/clientstates/client_states.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package clientstates
import (
"context"

peer "github.com/libp2p/go-libp2p-core/peer"

"github.com/filecoin-project/go-address"
datatransfer "github.com/filecoin-project/go-data-transfer"
"github.com/filecoin-project/go-statemachine/fsm"
"github.com/filecoin-project/specs-actors/actors/abi"
"github.com/filecoin-project/specs-actors/actors/abi/big"
peer "github.com/libp2p/go-libp2p-core/peer"

rm "github.com/filecoin-project/go-fil-markets/retrievalmarket"
)
Expand Down
7 changes: 4 additions & 3 deletions retrievalmarket/impl/clientstates/client_states_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@ import (
"math/rand"
"testing"

peer "github.com/libp2p/go-libp2p-core/peer"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/filecoin-project/go-address"
datatransfer "github.com/filecoin-project/go-data-transfer"
"github.com/filecoin-project/go-statemachine/fsm"
fsmtest "github.com/filecoin-project/go-statemachine/fsm/testutil"
"github.com/filecoin-project/specs-actors/actors/abi"
"github.com/filecoin-project/specs-actors/actors/abi/big"
"github.com/filecoin-project/specs-actors/actors/builtin/paych"
peer "github.com/libp2p/go-libp2p-core/peer"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/filecoin-project/go-fil-markets/retrievalmarket"
rm "github.com/filecoin-project/go-fil-markets/retrievalmarket"
Expand Down
3 changes: 2 additions & 1 deletion retrievalmarket/impl/dtutils/dtutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import (
"errors"
"math"

logging "github.com/ipfs/go-log/v2"

datatransfer "github.com/filecoin-project/go-data-transfer"
"github.com/filecoin-project/go-statemachine/fsm"
logging "github.com/ipfs/go-log/v2"

rm "github.com/filecoin-project/go-fil-markets/retrievalmarket"
)
Expand Down
6 changes: 4 additions & 2 deletions retrievalmarket/impl/dtutils/dtutils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ import (
"math/rand"
"testing"

"github.com/stretchr/testify/require"

datatransfer "github.com/filecoin-project/go-data-transfer"
"github.com/filecoin-project/go-statemachine/fsm"

"github.com/filecoin-project/go-fil-markets/retrievalmarket"
rm "github.com/filecoin-project/go-fil-markets/retrievalmarket"
"github.com/filecoin-project/go-fil-markets/retrievalmarket/impl/dtutils"
"github.com/filecoin-project/go-fil-markets/shared_testutil"
"github.com/filecoin-project/go-statemachine/fsm"
"github.com/stretchr/testify/require"
)

func TestProviderDataTransferSubscriber(t *testing.T) {
Expand Down
Loading