From 50c9ffa9e0fbca74b87e5fb72bc0c787f02417a8 Mon Sep 17 00:00:00 2001 From: Orpheus Lummis Date: Sun, 18 Sep 2022 08:18:10 -0500 Subject: [PATCH] chore: Add goimports linter for consistent imports ordering (#816) --- api/http/handler.go | 1 + api/http/handler_test.go | 3 ++- api/http/handlerfuncs.go | 1 + api/http/handlerfuncs_test.go | 5 +++-- api/http/logger_test.go | 3 ++- cli/blocks_get.go | 3 ++- cli/cli.go | 3 ++- cli/dump.go | 3 ++- cli/init.go | 3 ++- cli/peerid.go | 4 ++-- cli/peerid_test.go | 4 ++-- cli/ping.go | 3 ++- cli/root.go | 5 +++-- cli/serverdump.go | 3 ++- cli/start.go | 18 +++++++++--------- cli/version.go | 4 +++- client/db.go | 4 ++-- client/dockey.go | 4 ++-- client/document.go | 4 ++-- cmd/genclidocs/genclidocs.go | 4 ++-- cmd/genmanpages/main.go | 3 ++- config/config.go | 3 ++- config/config_test.go | 3 ++- core/crdt/base.go | 1 + core/crdt/base_test.go | 1 + core/crdt/composite.go | 8 ++++---- core/crdt/lwwreg.go | 10 ++++------ core/crdt/lwwreg_test.go | 9 ++++----- core/key.go | 1 + core/replicated.go | 4 ++-- datastore/badger/v3/datastore.go | 3 ++- datastore/badger/v3/iterator.go | 1 + datastore/blockstore.go | 4 ++-- datastore/shimstore.go | 1 + datastore/store.go | 1 + datastore/wrappedStore.go | 1 + db/collection.go | 10 +++++----- db/collection_test.go | 3 ++- db/collection_update.go | 9 ++++----- db/db.go | 12 ++++++------ db/db_test.go | 13 ++++++------- db/fetcher/dag.go | 6 +++--- db/fetcher/encoded_doc.go | 1 + db/fetcher/fetcher.go | 1 + db/fetcher/versioned.go | 10 +++++----- db/fetcher_test.go | 3 ++- db/query.go | 4 ++-- db/schema.go | 4 ++-- db/sequence.go | 1 + logging/logging_test.go | 4 ++-- merkle/clock/clock.go | 8 ++++---- merkle/clock/clock_test.go | 8 ++++---- merkle/clock/heads.go | 8 ++++---- merkle/clock/heads_test.go | 1 + merkle/clock/ipld.go | 6 +++--- merkle/crdt/composite.go | 4 ++-- merkle/crdt/lwwreg.go | 6 ++---- merkle/crdt/merklecrdt.go | 6 +++--- merkle/crdt/merklecrdt_test.go | 10 +++++----- net/api/pb/api.pb.go | 7 ++++--- net/client.go | 4 ++-- net/pb/net.pb.go | 7 ++++--- net/utils/util.go | 1 + node/node.go | 4 ++-- node/node_test.go | 5 +++-- query/graphql/mapper/mapper.go | 2 +- query/graphql/parser/commit.go | 1 + query/graphql/parser/filter.go | 1 + query/graphql/parser/mutation.go | 1 + query/graphql/parser/query.go | 1 + query/graphql/planner/commit.go | 1 + query/graphql/planner/dagscan.go | 10 +++++----- query/graphql/planner/executor.go | 8 ++++---- query/graphql/planner/group.go | 1 - query/graphql/planner/planner.go | 1 - query/graphql/planner/select.go | 4 ++-- query/graphql/planner/sum.go | 3 +-- query/graphql/planner/versionedscan.go | 4 ++-- query/graphql/schema/descriptions.go | 1 + query/graphql/schema/descriptions_test.go | 4 ++-- query/graphql/schema/generate.go | 6 ++---- query/graphql/schema/manager.go | 1 + query/graphql/schema/relations_test.go | 3 ++- tests/bench/fixtures/fixtures.go | 4 ++-- tests/integration/cli/log_config_test.go | 3 ++- .../create/one_to_many/simple_test.go | 3 ++- .../collection/create/one_to_one/save_test.go | 3 ++- .../collection/update/one_to_one/save_test.go | 3 ++- .../collection/update/simple/save_test.go | 3 ++- .../update/simple/with_filter_test.go | 3 ++- .../collection/update/simple/with_key_test.go | 3 ++- .../update/simple/with_keys_test.go | 3 ++- tests/integration/collection/utils.go | 3 ++- tests/integration/net/utils.go | 5 +++-- tests/integration/schema/utils.go | 3 ++- tools/configs/golangci.yaml | 19 +++++-------------- 96 files changed, 223 insertions(+), 190 deletions(-) diff --git a/api/http/handler.go b/api/http/handler.go index 9848008575..4fc6f3bd17 100644 --- a/api/http/handler.go +++ b/api/http/handler.go @@ -19,6 +19,7 @@ import ( "github.com/go-chi/chi/v5" "github.com/pkg/errors" + "github.com/sourcenetwork/defradb/client" ) diff --git a/api/http/handler_test.go b/api/http/handler_test.go index df8819e09b..5ffdb93c74 100644 --- a/api/http/handler_test.go +++ b/api/http/handler_test.go @@ -22,10 +22,11 @@ import ( badger "github.com/dgraph-io/badger/v3" "github.com/pkg/errors" + "github.com/stretchr/testify/assert" + badgerds "github.com/sourcenetwork/defradb/datastore/badger/v3" "github.com/sourcenetwork/defradb/db" "github.com/sourcenetwork/defradb/logging" - "github.com/stretchr/testify/assert" ) func TestSimpleDataResponse(t *testing.T) { diff --git a/api/http/handlerfuncs.go b/api/http/handlerfuncs.go index 45e36844e5..40666d2ff7 100644 --- a/api/http/handlerfuncs.go +++ b/api/http/handlerfuncs.go @@ -22,6 +22,7 @@ import ( dag "github.com/ipfs/go-merkledag" "github.com/multiformats/go-multihash" "github.com/pkg/errors" + corecrdt "github.com/sourcenetwork/defradb/core/crdt" ) diff --git a/api/http/handlerfuncs_test.go b/api/http/handlerfuncs_test.go index b740d0a5ee..f3bfe07fdb 100644 --- a/api/http/handlerfuncs_test.go +++ b/api/http/handlerfuncs_test.go @@ -24,12 +24,13 @@ import ( badger "github.com/dgraph-io/badger/v3" "github.com/ipfs/go-cid" dshelp "github.com/ipfs/go-ipfs-ds-help" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" + "github.com/sourcenetwork/defradb/client" badgerds "github.com/sourcenetwork/defradb/datastore/badger/v3" "github.com/sourcenetwork/defradb/db" "github.com/sourcenetwork/defradb/errors" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" ) type testOptions struct { diff --git a/api/http/logger_test.go b/api/http/logger_test.go index df5d82cb28..6edc534ddf 100644 --- a/api/http/logger_test.go +++ b/api/http/logger_test.go @@ -21,8 +21,9 @@ import ( "testing" "github.com/pkg/errors" - "github.com/sourcenetwork/defradb/logging" "github.com/stretchr/testify/assert" + + "github.com/sourcenetwork/defradb/logging" ) func TestNewLoggingResponseWriterLogger(t *testing.T) { diff --git a/cli/blocks_get.go b/cli/blocks_get.go index 890bbc963c..e63a846904 100644 --- a/cli/blocks_get.go +++ b/cli/blocks_get.go @@ -16,9 +16,10 @@ import ( "net/http" "os" + "github.com/spf13/cobra" + httpapi "github.com/sourcenetwork/defradb/api/http" "github.com/sourcenetwork/defradb/errors" - "github.com/spf13/cobra" ) var getCmd = &cobra.Command{ diff --git a/cli/cli.go b/cli/cli.go index 4087201514..2b263f9483 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -23,10 +23,11 @@ import ( "strconv" "strings" + "github.com/spf13/cobra" + "github.com/sourcenetwork/defradb/config" "github.com/sourcenetwork/defradb/errors" "github.com/sourcenetwork/defradb/logging" - "github.com/spf13/cobra" ) const badgerDatastoreName = "badger" diff --git a/cli/dump.go b/cli/dump.go index 3f46deb60c..071a52669d 100644 --- a/cli/dump.go +++ b/cli/dump.go @@ -17,9 +17,10 @@ import ( "net/http" "os" + "github.com/spf13/cobra" + httpapi "github.com/sourcenetwork/defradb/api/http" "github.com/sourcenetwork/defradb/errors" - "github.com/spf13/cobra" ) var dumpCmd = &cobra.Command{ diff --git a/cli/init.go b/cli/init.go index fa0b43c4fb..07ccc72723 100644 --- a/cli/init.go +++ b/cli/init.go @@ -14,9 +14,10 @@ import ( "fmt" "os" + "github.com/spf13/cobra" + "github.com/sourcenetwork/defradb/config" "github.com/sourcenetwork/defradb/errors" - "github.com/spf13/cobra" ) var reinitialize bool diff --git a/cli/peerid.go b/cli/peerid.go index 9ed2186385..23075ffa7c 100644 --- a/cli/peerid.go +++ b/cli/peerid.go @@ -17,10 +17,10 @@ import ( "net/http" "os" - "github.com/sourcenetwork/defradb/errors" + "github.com/spf13/cobra" httpapi "github.com/sourcenetwork/defradb/api/http" - "github.com/spf13/cobra" + "github.com/sourcenetwork/defradb/errors" ) var peerIDCmd = &cobra.Command{ diff --git a/cli/peerid_test.go b/cli/peerid_test.go index d0ebe51fc5..8095f9f8b7 100644 --- a/cli/peerid_test.go +++ b/cli/peerid_test.go @@ -18,10 +18,10 @@ import ( "net/http" "testing" + "github.com/stretchr/testify/assert" + httpapi "github.com/sourcenetwork/defradb/api/http" "github.com/sourcenetwork/defradb/config" - - "github.com/stretchr/testify/assert" ) // setTestingAddresses overrides the config addresses to be the ones reserved for testing. diff --git a/cli/ping.go b/cli/ping.go index 45a6bc39b7..6dbd16aa37 100644 --- a/cli/ping.go +++ b/cli/ping.go @@ -17,9 +17,10 @@ import ( "net/http" "os" + "github.com/spf13/cobra" + httpapi "github.com/sourcenetwork/defradb/api/http" "github.com/sourcenetwork/defradb/errors" - "github.com/spf13/cobra" ) var pingCmd = &cobra.Command{ diff --git a/cli/root.go b/cli/root.go index f9c26eb4ff..d2ca7a3707 100644 --- a/cli/root.go +++ b/cli/root.go @@ -14,10 +14,11 @@ import ( "context" "fmt" - "github.com/sourcenetwork/defradb/config" - "github.com/sourcenetwork/defradb/errors" "github.com/spf13/cobra" "github.com/spf13/viper" + + "github.com/sourcenetwork/defradb/config" + "github.com/sourcenetwork/defradb/errors" ) var rootDirParam string diff --git a/cli/serverdump.go b/cli/serverdump.go index 44f319b052..108e24d6e3 100644 --- a/cli/serverdump.go +++ b/cli/serverdump.go @@ -16,11 +16,12 @@ import ( "os/signal" ds "github.com/ipfs/go-datastore" + "github.com/spf13/cobra" + badgerds "github.com/sourcenetwork/defradb/datastore/badger/v3" "github.com/sourcenetwork/defradb/db" "github.com/sourcenetwork/defradb/errors" "github.com/sourcenetwork/defradb/logging" - "github.com/spf13/cobra" ) var datastore string diff --git a/cli/start.go b/cli/start.go index 1185983536..934ea7dce0 100644 --- a/cli/start.go +++ b/cli/start.go @@ -19,26 +19,26 @@ import ( "os/signal" "strings" + badger "github.com/dgraph-io/badger/v3" + ds "github.com/ipfs/go-datastore" ma "github.com/multiformats/go-multiaddr" + "github.com/spf13/cobra" + "github.com/spf13/viper" + "github.com/textileio/go-threads/broadcast" + "google.golang.org/grpc" + "google.golang.org/grpc/keepalive" + httpapi "github.com/sourcenetwork/defradb/api/http" "github.com/sourcenetwork/defradb/client" "github.com/sourcenetwork/defradb/config" badgerds "github.com/sourcenetwork/defradb/datastore/badger/v3" "github.com/sourcenetwork/defradb/db" "github.com/sourcenetwork/defradb/errors" + "github.com/sourcenetwork/defradb/logging" netapi "github.com/sourcenetwork/defradb/net/api" netpb "github.com/sourcenetwork/defradb/net/api/pb" netutils "github.com/sourcenetwork/defradb/net/utils" "github.com/sourcenetwork/defradb/node" - "google.golang.org/grpc" - "google.golang.org/grpc/keepalive" - - badger "github.com/dgraph-io/badger/v3" - ds "github.com/ipfs/go-datastore" - "github.com/sourcenetwork/defradb/logging" - "github.com/spf13/cobra" - "github.com/spf13/viper" - "github.com/textileio/go-threads/broadcast" ) const busBufferSize = 100 diff --git a/cli/version.go b/cli/version.go index a5f981577c..96a9ff1b0f 100644 --- a/cli/version.go +++ b/cli/version.go @@ -12,10 +12,12 @@ package cli import ( "bytes" + "encoding/json" - "github.com/sourcenetwork/defradb/version" "github.com/spf13/cobra" + + "github.com/sourcenetwork/defradb/version" ) var format string diff --git a/client/db.go b/client/db.go index f3c04b3e6a..f23767d41c 100644 --- a/client/db.go +++ b/client/db.go @@ -13,10 +13,10 @@ package client import ( "context" - "github.com/sourcenetwork/defradb/datastore" - ds "github.com/ipfs/go-datastore" blockstore "github.com/ipfs/go-ipfs-blockstore" + + "github.com/sourcenetwork/defradb/datastore" ) type DB interface { diff --git a/client/dockey.go b/client/dockey.go index 51652f5d48..c88ae2d0f4 100644 --- a/client/dockey.go +++ b/client/dockey.go @@ -15,11 +15,11 @@ import ( "encoding/binary" "strings" - "github.com/sourcenetwork/defradb/errors" - "github.com/ipfs/go-cid" mbase "github.com/multiformats/go-multibase" uuid "github.com/satori/go.uuid" + + "github.com/sourcenetwork/defradb/errors" ) // DocKey versions. diff --git a/client/document.go b/client/document.go index 3c1f17a3ab..456f43ee27 100644 --- a/client/document.go +++ b/client/document.go @@ -16,11 +16,11 @@ import ( "strings" "sync" - "github.com/sourcenetwork/defradb/errors" - "github.com/fxamacker/cbor/v2" "github.com/ipfs/go-cid" mh "github.com/multiformats/go-multihash" + + "github.com/sourcenetwork/defradb/errors" ) // This is the main implementation starting point for accessing the internal Document API diff --git a/cmd/genclidocs/genclidocs.go b/cmd/genclidocs/genclidocs.go index e2cec82bce..f644a63f6b 100644 --- a/cmd/genclidocs/genclidocs.go +++ b/cmd/genclidocs/genclidocs.go @@ -18,10 +18,10 @@ import ( "flag" "os" + "github.com/spf13/cobra/doc" + "github.com/sourcenetwork/defradb/cli" "github.com/sourcenetwork/defradb/logging" - - "github.com/spf13/cobra/doc" ) var log = logging.MustNewLogger("defra.genclidocs") diff --git a/cmd/genmanpages/main.go b/cmd/genmanpages/main.go index 4484d2578d..fe3f36d324 100644 --- a/cmd/genmanpages/main.go +++ b/cmd/genmanpages/main.go @@ -19,9 +19,10 @@ import ( "flag" "os" + "github.com/spf13/cobra/doc" + "github.com/sourcenetwork/defradb/cli" "github.com/sourcenetwork/defradb/logging" - "github.com/spf13/cobra/doc" ) const defaultPerm os.FileMode = 0o777 diff --git a/config/config.go b/config/config.go index 39604e6cf9..5ead94956b 100644 --- a/config/config.go +++ b/config/config.go @@ -58,11 +58,12 @@ import ( "github.com/mitchellh/mapstructure" ma "github.com/multiformats/go-multiaddr" + "github.com/spf13/viper" + badgerds "github.com/sourcenetwork/defradb/datastore/badger/v3" "github.com/sourcenetwork/defradb/errors" "github.com/sourcenetwork/defradb/logging" "github.com/sourcenetwork/defradb/node" - "github.com/spf13/viper" ) var log = logging.MustNewLogger("defra.config") diff --git a/config/config_test.go b/config/config_test.go index 6861deddb1..95e5510a5a 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -18,9 +18,10 @@ import ( "time" ma "github.com/multiformats/go-multiaddr" + "github.com/stretchr/testify/assert" + "github.com/sourcenetwork/defradb/logging" "github.com/sourcenetwork/defradb/node" - "github.com/stretchr/testify/assert" ) var envVarsDifferentThanDefault = map[string]string{ diff --git a/core/crdt/base.go b/core/crdt/base.go index 59e64782e6..7cb3a3b523 100644 --- a/core/crdt/base.go +++ b/core/crdt/base.go @@ -15,6 +15,7 @@ import ( "encoding/binary" ds "github.com/ipfs/go-datastore" + "github.com/sourcenetwork/defradb/core" "github.com/sourcenetwork/defradb/datastore" "github.com/sourcenetwork/defradb/errors" diff --git a/core/crdt/base_test.go b/core/crdt/base_test.go index a40de8950e..708f1b6de0 100644 --- a/core/crdt/base_test.go +++ b/core/crdt/base_test.go @@ -15,6 +15,7 @@ import ( "testing" ds "github.com/ipfs/go-datastore" + "github.com/sourcenetwork/defradb/core" "github.com/sourcenetwork/defradb/datastore" ) diff --git a/core/crdt/composite.go b/core/crdt/composite.go index d6513e97b9..d1c571f8fa 100644 --- a/core/crdt/composite.go +++ b/core/crdt/composite.go @@ -16,13 +16,13 @@ import ( "sort" "strings" - "github.com/sourcenetwork/defradb/core" - "github.com/sourcenetwork/defradb/datastore" - "github.com/sourcenetwork/defradb/errors" - ipld "github.com/ipfs/go-ipld-format" dag "github.com/ipfs/go-merkledag" "github.com/ugorji/go/codec" + + "github.com/sourcenetwork/defradb/core" + "github.com/sourcenetwork/defradb/datastore" + "github.com/sourcenetwork/defradb/errors" ) var ( diff --git a/core/crdt/lwwreg.go b/core/crdt/lwwreg.go index e8d0b3553d..4b64d58f44 100644 --- a/core/crdt/lwwreg.go +++ b/core/crdt/lwwreg.go @@ -16,16 +16,14 @@ import ( "bytes" "context" - "github.com/sourcenetwork/defradb/errors" + ipld "github.com/ipfs/go-ipld-format" + dag "github.com/ipfs/go-merkledag" + "github.com/ugorji/go/codec" "github.com/sourcenetwork/defradb/client" "github.com/sourcenetwork/defradb/core" "github.com/sourcenetwork/defradb/datastore" - - ipld "github.com/ipfs/go-ipld-format" - dag "github.com/ipfs/go-merkledag" - - "github.com/ugorji/go/codec" + "github.com/sourcenetwork/defradb/errors" ) var ( diff --git a/core/crdt/lwwreg_test.go b/core/crdt/lwwreg_test.go index da814af6bf..b1b928538c 100644 --- a/core/crdt/lwwreg_test.go +++ b/core/crdt/lwwreg_test.go @@ -17,14 +17,13 @@ import ( "github.com/ipfs/go-cid" ds "github.com/ipfs/go-datastore" - "github.com/sourcenetwork/defradb/core" - "github.com/sourcenetwork/defradb/datastore" - - "github.com/ugorji/go/codec" - ipld "github.com/ipfs/go-ipld-format" dag "github.com/ipfs/go-merkledag" mh "github.com/multiformats/go-multihash" + "github.com/ugorji/go/codec" + + "github.com/sourcenetwork/defradb/core" + "github.com/sourcenetwork/defradb/datastore" ) func newMockStore() datastore.DSReaderWriter { diff --git a/core/key.go b/core/key.go index c58d0589a7..935fd0fea0 100644 --- a/core/key.go +++ b/core/key.go @@ -17,6 +17,7 @@ import ( "github.com/ipfs/go-cid" ds "github.com/ipfs/go-datastore" + "github.com/sourcenetwork/defradb/client" "github.com/sourcenetwork/defradb/errors" ) diff --git a/core/replicated.go b/core/replicated.go index 3edc8bf578..b00e59b87f 100644 --- a/core/replicated.go +++ b/core/replicated.go @@ -13,10 +13,10 @@ package core import ( "context" - "github.com/sourcenetwork/defradb/errors" - cid "github.com/ipfs/go-cid" ipld "github.com/ipfs/go-ipld-format" + + "github.com/sourcenetwork/defradb/errors" ) var ( diff --git a/datastore/badger/v3/datastore.go b/datastore/badger/v3/datastore.go index e88f0c90b2..1ec9eed39c 100644 --- a/datastore/badger/v3/datastore.go +++ b/datastore/badger/v3/datastore.go @@ -16,9 +16,10 @@ import ( dsq "github.com/ipfs/go-datastore/query" logger "github.com/ipfs/go-log/v2" goprocess "github.com/jbenet/goprocess" + "go.uber.org/zap" + "github.com/sourcenetwork/defradb/datastore/iterable" "github.com/sourcenetwork/defradb/errors" - "go.uber.org/zap" ) var log = logger.Logger("badger") diff --git a/datastore/badger/v3/iterator.go b/datastore/badger/v3/iterator.go index 4c8ec05871..ac16ee28ea 100644 --- a/datastore/badger/v3/iterator.go +++ b/datastore/badger/v3/iterator.go @@ -22,6 +22,7 @@ import ( ds "github.com/ipfs/go-datastore" dsq "github.com/ipfs/go-datastore/query" goprocess "github.com/jbenet/goprocess" + "github.com/sourcenetwork/defradb/datastore/iterable" "github.com/sourcenetwork/defradb/errors" ) diff --git a/datastore/blockstore.go b/datastore/blockstore.go index 6fabfe4a10..722f505a78 100644 --- a/datastore/blockstore.go +++ b/datastore/blockstore.go @@ -13,8 +13,6 @@ package datastore import ( "context" - "github.com/sourcenetwork/defradb/errors" - blocks "github.com/ipfs/go-block-format" "github.com/ipfs/go-cid" ds "github.com/ipfs/go-datastore" @@ -22,6 +20,8 @@ import ( blockstore "github.com/ipfs/go-ipfs-blockstore" dshelp "github.com/ipfs/go-ipfs-ds-help" ipld "github.com/ipfs/go-ipld-format" + + "github.com/sourcenetwork/defradb/errors" ) // Blockstore implementation taken from: diff --git a/datastore/shimstore.go b/datastore/shimstore.go index 9439943b9b..018f9da5cf 100644 --- a/datastore/shimstore.go +++ b/datastore/shimstore.go @@ -12,6 +12,7 @@ package datastore import ( ds "github.com/ipfs/go-datastore" + "github.com/sourcenetwork/defradb/datastore/iterable" ) diff --git a/datastore/store.go b/datastore/store.go index 42b9948aab..73a6b6c966 100644 --- a/datastore/store.go +++ b/datastore/store.go @@ -13,6 +13,7 @@ package datastore import ( ds "github.com/ipfs/go-datastore" blockstore "github.com/ipfs/go-ipfs-blockstore" + "github.com/sourcenetwork/defradb/datastore/iterable" "github.com/sourcenetwork/defradb/logging" ) diff --git a/datastore/wrappedStore.go b/datastore/wrappedStore.go index 92afd5de24..2ed0d57741 100644 --- a/datastore/wrappedStore.go +++ b/datastore/wrappedStore.go @@ -17,6 +17,7 @@ import ( ktds "github.com/ipfs/go-datastore/keytransform" "github.com/ipfs/go-datastore/query" dsq "github.com/ipfs/go-datastore/query" + "github.com/sourcenetwork/defradb/datastore/iterable" ) diff --git a/db/collection.go b/db/collection.go index b60f26a9c4..47fc1319af 100644 --- a/db/collection.go +++ b/db/collection.go @@ -18,6 +18,11 @@ import ( "strings" "github.com/fxamacker/cbor/v2" + "github.com/ipfs/go-cid" + ds "github.com/ipfs/go-datastore" + "github.com/ipfs/go-datastore/query" + mh "github.com/multiformats/go-multihash" + "github.com/sourcenetwork/defradb/client" "github.com/sourcenetwork/defradb/core" "github.com/sourcenetwork/defradb/datastore" @@ -25,11 +30,6 @@ import ( "github.com/sourcenetwork/defradb/errors" "github.com/sourcenetwork/defradb/logging" "github.com/sourcenetwork/defradb/merkle/crdt" - - "github.com/ipfs/go-cid" - ds "github.com/ipfs/go-datastore" - "github.com/ipfs/go-datastore/query" - mh "github.com/multiformats/go-multihash" ) var ( diff --git a/db/collection_test.go b/db/collection_test.go index e98162dcce..3e284604b5 100644 --- a/db/collection_test.go +++ b/db/collection_test.go @@ -15,8 +15,9 @@ import ( "reflect" "testing" - "github.com/sourcenetwork/defradb/client" "github.com/stretchr/testify/assert" + + "github.com/sourcenetwork/defradb/client" ) func newTestCollectionWithSchema(ctx context.Context, db client.DB) (client.Collection, error) { diff --git a/db/collection_update.go b/db/collection_update.go index d9c70e1d93..5c7037d36b 100644 --- a/db/collection_update.go +++ b/db/collection_update.go @@ -15,18 +15,17 @@ import ( "strings" "time" + cbor "github.com/fxamacker/cbor/v2" + "github.com/valyala/fastjson" + "github.com/sourcenetwork/defradb/client" "github.com/sourcenetwork/defradb/core" "github.com/sourcenetwork/defradb/datastore" "github.com/sourcenetwork/defradb/errors" "github.com/sourcenetwork/defradb/query/graphql/mapper" "github.com/sourcenetwork/defradb/query/graphql/parser" - "github.com/sourcenetwork/defradb/query/graphql/planner" - parserTypes "github.com/sourcenetwork/defradb/query/graphql/parser/types" - - cbor "github.com/fxamacker/cbor/v2" - "github.com/valyala/fastjson" + "github.com/sourcenetwork/defradb/query/graphql/planner" ) var ( diff --git a/db/db.go b/db/db.go index a36a4ac815..c96bcddcac 100644 --- a/db/db.go +++ b/db/db.go @@ -18,20 +18,20 @@ import ( "context" "sync" + ds "github.com/ipfs/go-datastore" + "github.com/ipfs/go-datastore/query" + dsq "github.com/ipfs/go-datastore/query" + blockstore "github.com/ipfs/go-ipfs-blockstore" + "github.com/sourcenetwork/defradb/client" "github.com/sourcenetwork/defradb/core" corenet "github.com/sourcenetwork/defradb/core/net" "github.com/sourcenetwork/defradb/datastore" "github.com/sourcenetwork/defradb/errors" + "github.com/sourcenetwork/defradb/logging" "github.com/sourcenetwork/defradb/merkle/crdt" "github.com/sourcenetwork/defradb/query/graphql/planner" "github.com/sourcenetwork/defradb/query/graphql/schema" - - ds "github.com/ipfs/go-datastore" - "github.com/ipfs/go-datastore/query" - dsq "github.com/ipfs/go-datastore/query" - blockstore "github.com/ipfs/go-ipfs-blockstore" - "github.com/sourcenetwork/defradb/logging" ) var ( diff --git a/db/db_test.go b/db/db_test.go index 068c43fc7d..a331a090a4 100644 --- a/db/db_test.go +++ b/db/db_test.go @@ -14,17 +14,16 @@ import ( "context" "testing" - "github.com/sourcenetwork/defradb/client" - "github.com/sourcenetwork/defradb/core" - - corecrdt "github.com/sourcenetwork/defradb/core/crdt" - "github.com/sourcenetwork/defradb/merkle/clock" - badger "github.com/dgraph-io/badger/v3" ds "github.com/ipfs/go-datastore" dag "github.com/ipfs/go-merkledag" - badgerds "github.com/sourcenetwork/defradb/datastore/badger/v3" "github.com/stretchr/testify/assert" + + "github.com/sourcenetwork/defradb/client" + "github.com/sourcenetwork/defradb/core" + corecrdt "github.com/sourcenetwork/defradb/core/crdt" + badgerds "github.com/sourcenetwork/defradb/datastore/badger/v3" + "github.com/sourcenetwork/defradb/merkle/clock" ) func newMemoryDB(ctx context.Context) (*db, error) { diff --git a/db/fetcher/dag.go b/db/fetcher/dag.go index b7211dfe21..0e46358e80 100644 --- a/db/fetcher/dag.go +++ b/db/fetcher/dag.go @@ -15,12 +15,12 @@ import ( "sort" "strings" + "github.com/ipfs/go-cid" + dsq "github.com/ipfs/go-datastore/query" + "github.com/sourcenetwork/defradb/core" "github.com/sourcenetwork/defradb/datastore" "github.com/sourcenetwork/defradb/errors" - - "github.com/ipfs/go-cid" - dsq "github.com/ipfs/go-datastore/query" ) // @todo: Generalize all Fetchers into an shared Fetcher utility diff --git a/db/fetcher/encoded_doc.go b/db/fetcher/encoded_doc.go index 674f1a417c..ad941665c2 100644 --- a/db/fetcher/encoded_doc.go +++ b/db/fetcher/encoded_doc.go @@ -14,6 +14,7 @@ import ( "fmt" "github.com/fxamacker/cbor/v2" + "github.com/sourcenetwork/defradb/client" "github.com/sourcenetwork/defradb/core" "github.com/sourcenetwork/defradb/errors" diff --git a/db/fetcher/fetcher.go b/db/fetcher/fetcher.go index 9eb15dc352..e54feb9ae7 100644 --- a/db/fetcher/fetcher.go +++ b/db/fetcher/fetcher.go @@ -15,6 +15,7 @@ import ( "context" dsq "github.com/ipfs/go-datastore/query" + "github.com/sourcenetwork/defradb/client" "github.com/sourcenetwork/defradb/core" "github.com/sourcenetwork/defradb/datastore" diff --git a/db/fetcher/versioned.go b/db/fetcher/versioned.go index e3a6320465..2f18808b6f 100644 --- a/db/fetcher/versioned.go +++ b/db/fetcher/versioned.go @@ -15,17 +15,17 @@ import ( "context" "fmt" + "github.com/ipfs/go-cid" + ds "github.com/ipfs/go-datastore" + format "github.com/ipfs/go-ipld-format" + dag "github.com/ipfs/go-merkledag" + "github.com/sourcenetwork/defradb/client" "github.com/sourcenetwork/defradb/core" "github.com/sourcenetwork/defradb/datastore" "github.com/sourcenetwork/defradb/db/base" "github.com/sourcenetwork/defradb/errors" "github.com/sourcenetwork/defradb/merkle/crdt" - - "github.com/ipfs/go-cid" - ds "github.com/ipfs/go-datastore" - format "github.com/ipfs/go-ipld-format" - dag "github.com/ipfs/go-merkledag" ) var ( diff --git a/db/fetcher_test.go b/db/fetcher_test.go index d5a33d0692..1b9c2077d5 100644 --- a/db/fetcher_test.go +++ b/db/fetcher_test.go @@ -14,11 +14,12 @@ import ( "context" "testing" + "github.com/stretchr/testify/assert" + "github.com/sourcenetwork/defradb/client" "github.com/sourcenetwork/defradb/core" "github.com/sourcenetwork/defradb/db/base" "github.com/sourcenetwork/defradb/db/fetcher" - "github.com/stretchr/testify/assert" ) func newTestCollectionDescription() client.CollectionDescription { diff --git a/db/query.go b/db/query.go index d4e8e8f007..72a4a3898e 100644 --- a/db/query.go +++ b/db/query.go @@ -14,10 +14,10 @@ import ( "context" "strings" + gql "github.com/graphql-go/graphql" + "github.com/sourcenetwork/defradb/client" "github.com/sourcenetwork/defradb/datastore" - - gql "github.com/graphql-go/graphql" ) func (db *db) ExecQuery(ctx context.Context, query string) *client.QueryResult { diff --git a/db/schema.go b/db/schema.go index 0464c2f3ba..e7ea55d300 100644 --- a/db/schema.go +++ b/db/schema.go @@ -13,10 +13,10 @@ package db import ( "context" + "github.com/graphql-go/graphql/language/ast" dsq "github.com/ipfs/go-datastore/query" - "github.com/sourcenetwork/defradb/core" - "github.com/graphql-go/graphql/language/ast" + "github.com/sourcenetwork/defradb/core" ) // LoadSchema takes the provided schema in SDL format, and applies it to the database, diff --git a/db/sequence.go b/db/sequence.go index 672a0b2a16..6acbf82e56 100644 --- a/db/sequence.go +++ b/db/sequence.go @@ -15,6 +15,7 @@ import ( "encoding/binary" ds "github.com/ipfs/go-datastore" + "github.com/sourcenetwork/defradb/core" "github.com/sourcenetwork/defradb/errors" ) diff --git a/logging/logging_test.go b/logging/logging_test.go index a395e9ec3d..1789cb31a8 100644 --- a/logging/logging_test.go +++ b/logging/logging_test.go @@ -20,9 +20,9 @@ import ( "os/exec" "testing" - "github.com/sourcenetwork/defradb/errors" - "github.com/stretchr/testify/assert" + + "github.com/sourcenetwork/defradb/errors" ) func TestLogWritesFatalMessageToLogAndKillsProcess(t *testing.T) { diff --git a/merkle/clock/clock.go b/merkle/clock/clock.go index 2558fae116..73641672e7 100644 --- a/merkle/clock/clock.go +++ b/merkle/clock/clock.go @@ -14,13 +14,13 @@ import ( "context" "fmt" - "github.com/sourcenetwork/defradb/core" - "github.com/sourcenetwork/defradb/datastore" - "github.com/sourcenetwork/defradb/errors" - cid "github.com/ipfs/go-cid" dshelp "github.com/ipfs/go-ipfs-ds-help" ipld "github.com/ipfs/go-ipld-format" + + "github.com/sourcenetwork/defradb/core" + "github.com/sourcenetwork/defradb/datastore" + "github.com/sourcenetwork/defradb/errors" "github.com/sourcenetwork/defradb/logging" ) diff --git a/merkle/clock/clock_test.go b/merkle/clock/clock_test.go index 06ce54149b..59096bd032 100644 --- a/merkle/clock/clock_test.go +++ b/merkle/clock/clock_test.go @@ -14,13 +14,13 @@ import ( "context" "testing" - "github.com/sourcenetwork/defradb/core" - "github.com/sourcenetwork/defradb/core/crdt" - "github.com/sourcenetwork/defradb/datastore" - cid "github.com/ipfs/go-cid" ds "github.com/ipfs/go-datastore" mh "github.com/multiformats/go-multihash" + + "github.com/sourcenetwork/defradb/core" + "github.com/sourcenetwork/defradb/core/crdt" + "github.com/sourcenetwork/defradb/datastore" ) func newDS() ds.Datastore { diff --git a/merkle/clock/heads.go b/merkle/clock/heads.go index df50304ccc..cc7763385e 100644 --- a/merkle/clock/heads.go +++ b/merkle/clock/heads.go @@ -16,14 +16,14 @@ import ( "encoding/binary" "sort" + cid "github.com/ipfs/go-cid" + ds "github.com/ipfs/go-datastore" + "github.com/ipfs/go-datastore/query" + "github.com/sourcenetwork/defradb/core" "github.com/sourcenetwork/defradb/datastore" "github.com/sourcenetwork/defradb/errors" "github.com/sourcenetwork/defradb/logging" - - cid "github.com/ipfs/go-cid" - ds "github.com/ipfs/go-datastore" - "github.com/ipfs/go-datastore/query" ) // heads manages the current Merkle-CRDT heads. diff --git a/merkle/clock/heads_test.go b/merkle/clock/heads_test.go index 3a6e5ad9f8..cb955fdc8d 100644 --- a/merkle/clock/heads_test.go +++ b/merkle/clock/heads_test.go @@ -22,6 +22,7 @@ import ( "github.com/ipfs/go-cid" ds "github.com/ipfs/go-datastore" mh "github.com/multiformats/go-multihash" + "github.com/sourcenetwork/defradb/core" "github.com/sourcenetwork/defradb/datastore" "github.com/sourcenetwork/defradb/errors" diff --git a/merkle/clock/ipld.go b/merkle/clock/ipld.go index e433f2aaa0..a63313c740 100644 --- a/merkle/clock/ipld.go +++ b/merkle/clock/ipld.go @@ -13,13 +13,13 @@ package clock import ( "context" - "github.com/sourcenetwork/defradb/core" - - mh "github.com/multiformats/go-multihash" // pb "github.com/ipfs/go-ds-crdt/pb" cid "github.com/ipfs/go-cid" ipld "github.com/ipfs/go-ipld-format" dag "github.com/ipfs/go-merkledag" + mh "github.com/multiformats/go-multihash" + + "github.com/sourcenetwork/defradb/core" ) // Credit: This file is from github.com/ipfs/go-ds-crdt diff --git a/merkle/crdt/composite.go b/merkle/crdt/composite.go index abc15dba69..56d0cafae7 100644 --- a/merkle/crdt/composite.go +++ b/merkle/crdt/composite.go @@ -13,14 +13,14 @@ package crdt import ( "context" + "github.com/ipfs/go-cid" + "github.com/sourcenetwork/defradb/client" "github.com/sourcenetwork/defradb/core" corecrdt "github.com/sourcenetwork/defradb/core/crdt" corenet "github.com/sourcenetwork/defradb/core/net" "github.com/sourcenetwork/defradb/datastore" "github.com/sourcenetwork/defradb/merkle/clock" - - "github.com/ipfs/go-cid" ) var ( diff --git a/merkle/crdt/lwwreg.go b/merkle/crdt/lwwreg.go index 8e9ce00128..fbd4c5f0de 100644 --- a/merkle/crdt/lwwreg.go +++ b/merkle/crdt/lwwreg.go @@ -13,16 +13,14 @@ package crdt import ( "context" + "github.com/ipfs/go-cid" + "github.com/sourcenetwork/defradb/client" "github.com/sourcenetwork/defradb/core" corecrdt "github.com/sourcenetwork/defradb/core/crdt" corenet "github.com/sourcenetwork/defradb/core/net" "github.com/sourcenetwork/defradb/datastore" "github.com/sourcenetwork/defradb/merkle/clock" - - // "github.com/sourcenetwork/defradb/datastore" - - "github.com/ipfs/go-cid" ) var ( diff --git a/merkle/crdt/merklecrdt.go b/merkle/crdt/merklecrdt.go index 134cdb3e42..9de4ed1cd7 100644 --- a/merkle/crdt/merklecrdt.go +++ b/merkle/crdt/merklecrdt.go @@ -14,12 +14,12 @@ import ( "context" "time" + "github.com/ipfs/go-cid" + ipld "github.com/ipfs/go-ipld-format" + "github.com/sourcenetwork/defradb/core" corenet "github.com/sourcenetwork/defradb/core/net" "github.com/sourcenetwork/defradb/errors" - - "github.com/ipfs/go-cid" - ipld "github.com/ipfs/go-ipld-format" "github.com/sourcenetwork/defradb/logging" ) diff --git a/merkle/crdt/merklecrdt_test.go b/merkle/crdt/merklecrdt_test.go index baf7a9b976..b67af13798 100644 --- a/merkle/crdt/merklecrdt_test.go +++ b/merkle/crdt/merklecrdt_test.go @@ -14,15 +14,15 @@ import ( "context" "testing" - "github.com/sourcenetwork/defradb/core" - corecrdt "github.com/sourcenetwork/defradb/core/crdt" - "github.com/sourcenetwork/defradb/datastore" - "github.com/sourcenetwork/defradb/merkle/clock" - "github.com/ipfs/go-cid" ds "github.com/ipfs/go-datastore" "github.com/ipfs/go-datastore/query" + + "github.com/sourcenetwork/defradb/core" + corecrdt "github.com/sourcenetwork/defradb/core/crdt" + "github.com/sourcenetwork/defradb/datastore" "github.com/sourcenetwork/defradb/logging" + "github.com/sourcenetwork/defradb/merkle/clock" ) func newDS() ds.Datastore { diff --git a/net/api/pb/api.pb.go b/net/api/pb/api.pb.go index 5ce44733c8..191799f90d 100644 --- a/net/api/pb/api.pb.go +++ b/net/api/pb/api.pb.go @@ -6,13 +6,14 @@ package api_pb import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + proto "github.com/gogo/protobuf/proto" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/net/client.go b/net/client.go index ba0994a179..be5cfcafe5 100644 --- a/net/client.go +++ b/net/client.go @@ -18,12 +18,12 @@ import ( "time" "github.com/libp2p/go-libp2p-core/peer" + "github.com/sourcenetwork/defradb/client" + "github.com/sourcenetwork/defradb/core" "github.com/sourcenetwork/defradb/errors" "github.com/sourcenetwork/defradb/logging" pb "github.com/sourcenetwork/defradb/net/pb" - - "github.com/sourcenetwork/defradb/core" ) var ( diff --git a/net/pb/net.pb.go b/net/pb/net.pb.go index 6e346ecb27..b060c4ec53 100644 --- a/net/pb/net.pb.go +++ b/net/pb/net.pb.go @@ -6,14 +6,15 @@ package net_pb import ( context "context" fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. diff --git a/net/utils/util.go b/net/utils/util.go index 18df9a2b7d..227fbed15a 100644 --- a/net/utils/util.go +++ b/net/utils/util.go @@ -17,6 +17,7 @@ import ( "github.com/libp2p/go-libp2p-core/peer" ma "github.com/multiformats/go-multiaddr" + "github.com/sourcenetwork/defradb/errors" ) diff --git a/node/node.go b/node/node.go index 38f73c0d31..97c2b0f94a 100644 --- a/node/node.go +++ b/node/node.go @@ -34,12 +34,12 @@ import ( "github.com/libp2p/go-libp2p-core/peer" "github.com/libp2p/go-libp2p-peerstore/pstoreds" pubsub "github.com/libp2p/go-libp2p-pubsub" - "github.com/sourcenetwork/defradb/errors" - "github.com/sourcenetwork/defradb/logging" "github.com/textileio/go-libp2p-pubsub-rpc/finalizer" "github.com/textileio/go-threads/broadcast" "github.com/sourcenetwork/defradb/client" + "github.com/sourcenetwork/defradb/errors" + "github.com/sourcenetwork/defradb/logging" "github.com/sourcenetwork/defradb/net" ) diff --git a/node/node_test.go b/node/node_test.go index 56184715b4..ea39b69a91 100644 --- a/node/node_test.go +++ b/node/node_test.go @@ -15,11 +15,12 @@ import ( "testing" badger "github.com/dgraph-io/badger/v3" + "github.com/stretchr/testify/assert" + "github.com/textileio/go-threads/broadcast" + "github.com/sourcenetwork/defradb/client" badgerds "github.com/sourcenetwork/defradb/datastore/badger/v3" "github.com/sourcenetwork/defradb/db" - "github.com/stretchr/testify/assert" - "github.com/textileio/go-threads/broadcast" ) // Node.Boostrap is not tested because the underlying, *ipfslite.Peer.Bootstrap is a best-effort function. diff --git a/query/graphql/mapper/mapper.go b/query/graphql/mapper/mapper.go index b4df79c201..b9f257bf69 100644 --- a/query/graphql/mapper/mapper.go +++ b/query/graphql/mapper/mapper.go @@ -18,6 +18,7 @@ import ( "strings" "github.com/graphql-go/graphql/language/ast" + "github.com/sourcenetwork/defradb/client" "github.com/sourcenetwork/defradb/connor" "github.com/sourcenetwork/defradb/core" @@ -25,7 +26,6 @@ import ( "github.com/sourcenetwork/defradb/datastore" "github.com/sourcenetwork/defradb/errors" "github.com/sourcenetwork/defradb/query/graphql/parser" - parserTypes "github.com/sourcenetwork/defradb/query/graphql/parser/types" ) diff --git a/query/graphql/parser/commit.go b/query/graphql/parser/commit.go index 0599007160..689de05f68 100644 --- a/query/graphql/parser/commit.go +++ b/query/graphql/parser/commit.go @@ -12,6 +12,7 @@ package parser import ( "github.com/graphql-go/graphql/language/ast" + "github.com/sourcenetwork/defradb/errors" parserTypes "github.com/sourcenetwork/defradb/query/graphql/parser/types" ) diff --git a/query/graphql/parser/filter.go b/query/graphql/parser/filter.go index 54ba75ddc6..be1bbf39c8 100644 --- a/query/graphql/parser/filter.go +++ b/query/graphql/parser/filter.go @@ -18,6 +18,7 @@ import ( "github.com/graphql-go/graphql/language/ast" gqlp "github.com/graphql-go/graphql/language/parser" gqls "github.com/graphql-go/graphql/language/source" + "github.com/sourcenetwork/defradb/errors" parserTypes "github.com/sourcenetwork/defradb/query/graphql/parser/types" ) diff --git a/query/graphql/parser/mutation.go b/query/graphql/parser/mutation.go index 5b937f22d2..eca2fc3f21 100644 --- a/query/graphql/parser/mutation.go +++ b/query/graphql/parser/mutation.go @@ -14,6 +14,7 @@ import ( "strings" "github.com/graphql-go/graphql/language/ast" + "github.com/sourcenetwork/defradb/errors" parserTypes "github.com/sourcenetwork/defradb/query/graphql/parser/types" ) diff --git a/query/graphql/parser/query.go b/query/graphql/parser/query.go index 8bca97bb63..c3da4a5a52 100644 --- a/query/graphql/parser/query.go +++ b/query/graphql/parser/query.go @@ -14,6 +14,7 @@ import ( "strconv" "github.com/graphql-go/graphql/language/ast" + "github.com/sourcenetwork/defradb/errors" parserTypes "github.com/sourcenetwork/defradb/query/graphql/parser/types" ) diff --git a/query/graphql/planner/commit.go b/query/graphql/planner/commit.go index ea42f7ff86..c5732443db 100644 --- a/query/graphql/planner/commit.go +++ b/query/graphql/planner/commit.go @@ -14,6 +14,7 @@ import ( "math" cid "github.com/ipfs/go-cid" + "github.com/sourcenetwork/defradb/core" "github.com/sourcenetwork/defradb/errors" "github.com/sourcenetwork/defradb/query/graphql/mapper" diff --git a/query/graphql/planner/dagscan.go b/query/graphql/planner/dagscan.go index 9465098f98..85457d7e69 100644 --- a/query/graphql/planner/dagscan.go +++ b/query/graphql/planner/dagscan.go @@ -35,16 +35,16 @@ import ( "container/list" "strings" - "github.com/sourcenetwork/defradb/core" - "github.com/sourcenetwork/defradb/db/fetcher" - "github.com/sourcenetwork/defradb/errors" - "github.com/sourcenetwork/defradb/query/graphql/mapper" - "github.com/fxamacker/cbor/v2" blocks "github.com/ipfs/go-block-format" cid "github.com/ipfs/go-cid" ipld "github.com/ipfs/go-ipld-format" dag "github.com/ipfs/go-merkledag" + + "github.com/sourcenetwork/defradb/core" + "github.com/sourcenetwork/defradb/db/fetcher" + "github.com/sourcenetwork/defradb/errors" + "github.com/sourcenetwork/defradb/query/graphql/mapper" parserTypes "github.com/sourcenetwork/defradb/query/graphql/parser/types" ) diff --git a/query/graphql/planner/executor.go b/query/graphql/planner/executor.go index 64d4b308e3..b43bd8fa92 100644 --- a/query/graphql/planner/executor.go +++ b/query/graphql/planner/executor.go @@ -14,16 +14,16 @@ import ( "context" "fmt" + gql "github.com/graphql-go/graphql" + gqlp "github.com/graphql-go/graphql/language/parser" + "github.com/graphql-go/graphql/language/source" + "github.com/sourcenetwork/defradb/client" "github.com/sourcenetwork/defradb/datastore" "github.com/sourcenetwork/defradb/errors" "github.com/sourcenetwork/defradb/query/graphql/mapper" "github.com/sourcenetwork/defradb/query/graphql/parser" "github.com/sourcenetwork/defradb/query/graphql/schema" - - gql "github.com/graphql-go/graphql" - gqlp "github.com/graphql-go/graphql/language/parser" - "github.com/graphql-go/graphql/language/source" ) // Query is an external hook into the planNode diff --git a/query/graphql/planner/group.go b/query/graphql/planner/group.go index 1028e9b346..9cfbca8f20 100644 --- a/query/graphql/planner/group.go +++ b/query/graphql/planner/group.go @@ -16,7 +16,6 @@ import ( "github.com/sourcenetwork/defradb/core" "github.com/sourcenetwork/defradb/errors" "github.com/sourcenetwork/defradb/query/graphql/mapper" - parserTypes "github.com/sourcenetwork/defradb/query/graphql/parser/types" ) diff --git a/query/graphql/planner/planner.go b/query/graphql/planner/planner.go index 547d0908d4..565704c83b 100644 --- a/query/graphql/planner/planner.go +++ b/query/graphql/planner/planner.go @@ -22,7 +22,6 @@ import ( "github.com/sourcenetwork/defradb/logging" "github.com/sourcenetwork/defradb/query/graphql/mapper" "github.com/sourcenetwork/defradb/query/graphql/parser" - parserTypes "github.com/sourcenetwork/defradb/query/graphql/parser/types" ) diff --git a/query/graphql/planner/select.go b/query/graphql/planner/select.go index 36fbc49212..f77544d72e 100644 --- a/query/graphql/planner/select.go +++ b/query/graphql/planner/select.go @@ -11,13 +11,13 @@ package planner import ( + cid "github.com/ipfs/go-cid" + "github.com/sourcenetwork/defradb/core" "github.com/sourcenetwork/defradb/db/base" "github.com/sourcenetwork/defradb/db/fetcher" "github.com/sourcenetwork/defradb/errors" "github.com/sourcenetwork/defradb/query/graphql/mapper" - - cid "github.com/ipfs/go-cid" parserTypes "github.com/sourcenetwork/defradb/query/graphql/parser/types" ) diff --git a/query/graphql/planner/sum.go b/query/graphql/planner/sum.go index bdd4f801b7..6525c573e4 100644 --- a/query/graphql/planner/sum.go +++ b/query/graphql/planner/sum.go @@ -15,9 +15,8 @@ import ( "github.com/sourcenetwork/defradb/client" "github.com/sourcenetwork/defradb/core" - "github.com/sourcenetwork/defradb/errors" - "github.com/sourcenetwork/defradb/core/enumerable" + "github.com/sourcenetwork/defradb/errors" "github.com/sourcenetwork/defradb/query/graphql/mapper" parserTypes "github.com/sourcenetwork/defradb/query/graphql/parser/types" ) diff --git a/query/graphql/planner/versionedscan.go b/query/graphql/planner/versionedscan.go index 6ded708b4f..df9cae21d9 100644 --- a/query/graphql/planner/versionedscan.go +++ b/query/graphql/planner/versionedscan.go @@ -11,13 +11,13 @@ package planner import ( + "github.com/ipfs/go-cid" + "github.com/sourcenetwork/defradb/client" "github.com/sourcenetwork/defradb/core" "github.com/sourcenetwork/defradb/db/fetcher" "github.com/sourcenetwork/defradb/errors" "github.com/sourcenetwork/defradb/query/graphql/mapper" - - "github.com/ipfs/go-cid" ) var ( diff --git a/query/graphql/schema/descriptions.go b/query/graphql/schema/descriptions.go index 2970c2a275..3a1a9a80e7 100644 --- a/query/graphql/schema/descriptions.go +++ b/query/graphql/schema/descriptions.go @@ -16,6 +16,7 @@ import ( "strings" gql "github.com/graphql-go/graphql" + "github.com/sourcenetwork/defradb/client" "github.com/sourcenetwork/defradb/errors" parserTypes "github.com/sourcenetwork/defradb/query/graphql/parser/types" diff --git a/query/graphql/schema/descriptions_test.go b/query/graphql/schema/descriptions_test.go index d7e32b3ec7..194ea906ea 100644 --- a/query/graphql/schema/descriptions_test.go +++ b/query/graphql/schema/descriptions_test.go @@ -14,9 +14,9 @@ import ( "context" "testing" - "github.com/sourcenetwork/defradb/client" - "github.com/stretchr/testify/assert" + + "github.com/sourcenetwork/defradb/client" ) var testDefaultIndex = []client.IndexDescription{ diff --git a/query/graphql/schema/generate.go b/query/graphql/schema/generate.go index 92fe947588..738b628aed 100644 --- a/query/graphql/schema/generate.go +++ b/query/graphql/schema/generate.go @@ -14,16 +14,14 @@ import ( "context" "fmt" + gql "github.com/graphql-go/graphql" "github.com/graphql-go/graphql/language/ast" + gqlp "github.com/graphql-go/graphql/language/parser" "github.com/graphql-go/graphql/language/source" "github.com/sourcenetwork/defradb/client" "github.com/sourcenetwork/defradb/errors" "github.com/sourcenetwork/defradb/logging" - - gql "github.com/graphql-go/graphql" - gqlp "github.com/graphql-go/graphql/language/parser" - parserTypes "github.com/sourcenetwork/defradb/query/graphql/parser/types" schemaTypes "github.com/sourcenetwork/defradb/query/graphql/schema/types" ) diff --git a/query/graphql/schema/manager.go b/query/graphql/schema/manager.go index 19268a88fc..ec07df335e 100644 --- a/query/graphql/schema/manager.go +++ b/query/graphql/schema/manager.go @@ -12,6 +12,7 @@ package schema import ( gql "github.com/graphql-go/graphql" + schemaTypes "github.com/sourcenetwork/defradb/query/graphql/schema/types" ) diff --git a/query/graphql/schema/relations_test.go b/query/graphql/schema/relations_test.go index 4a179ced1c..02c3084915 100644 --- a/query/graphql/schema/relations_test.go +++ b/query/graphql/schema/relations_test.go @@ -13,8 +13,9 @@ package schema import ( "testing" - "github.com/sourcenetwork/defradb/client" "github.com/stretchr/testify/assert" + + "github.com/sourcenetwork/defradb/client" ) func TestSimpleOneToOneFromSingle(t *testing.T) { diff --git a/tests/bench/fixtures/fixtures.go b/tests/bench/fixtures/fixtures.go index e70b6e0cd9..7b19b58f68 100644 --- a/tests/bench/fixtures/fixtures.go +++ b/tests/bench/fixtures/fixtures.go @@ -17,9 +17,9 @@ import ( "fmt" "reflect" - "github.com/sourcenetwork/defradb/errors" - "github.com/bxcodec/faker" + + "github.com/sourcenetwork/defradb/errors" ) var ( diff --git a/tests/integration/cli/log_config_test.go b/tests/integration/cli/log_config_test.go index 2acd1477d8..fffdcfbef6 100644 --- a/tests/integration/cli/log_config_test.go +++ b/tests/integration/cli/log_config_test.go @@ -19,9 +19,10 @@ import ( "os" "testing" + "github.com/stretchr/testify/assert" + "github.com/sourcenetwork/defradb/cli" "github.com/sourcenetwork/defradb/logging" - "github.com/stretchr/testify/assert" ) const ( diff --git a/tests/integration/collection/create/one_to_many/simple_test.go b/tests/integration/collection/create/one_to_many/simple_test.go index 25a817ec14..535209410d 100644 --- a/tests/integration/collection/create/one_to_many/simple_test.go +++ b/tests/integration/collection/create/one_to_many/simple_test.go @@ -14,9 +14,10 @@ import ( "context" "testing" + "github.com/stretchr/testify/assert" + "github.com/sourcenetwork/defradb/client" testUtils "github.com/sourcenetwork/defradb/tests/integration/collection" - "github.com/stretchr/testify/assert" ) func TestCreateSaveErrorsGivenValueInRelationField(t *testing.T) { diff --git a/tests/integration/collection/create/one_to_one/save_test.go b/tests/integration/collection/create/one_to_one/save_test.go index c0017f2267..fa39114cf0 100644 --- a/tests/integration/collection/create/one_to_one/save_test.go +++ b/tests/integration/collection/create/one_to_one/save_test.go @@ -14,9 +14,10 @@ import ( "context" "testing" + "github.com/stretchr/testify/assert" + "github.com/sourcenetwork/defradb/client" testUtils "github.com/sourcenetwork/defradb/tests/integration/collection" - "github.com/stretchr/testify/assert" ) func TestCollectionCreateSaveErrorsGivenRelationSetOnWrongSide(t *testing.T) { diff --git a/tests/integration/collection/update/one_to_one/save_test.go b/tests/integration/collection/update/one_to_one/save_test.go index 03bb711a61..631de53f0d 100644 --- a/tests/integration/collection/update/one_to_one/save_test.go +++ b/tests/integration/collection/update/one_to_one/save_test.go @@ -14,9 +14,10 @@ import ( "context" "testing" + "github.com/stretchr/testify/assert" + "github.com/sourcenetwork/defradb/client" testUtils "github.com/sourcenetwork/defradb/tests/integration/collection" - "github.com/stretchr/testify/assert" ) func TestUpdateOneToOneSaveErrorsGivenWrongSideOfRelation(t *testing.T) { diff --git a/tests/integration/collection/update/simple/save_test.go b/tests/integration/collection/update/simple/save_test.go index 1aa57d18e0..d9501418f7 100644 --- a/tests/integration/collection/update/simple/save_test.go +++ b/tests/integration/collection/update/simple/save_test.go @@ -14,9 +14,10 @@ import ( "context" "testing" + "github.com/stretchr/testify/assert" + "github.com/sourcenetwork/defradb/client" testUtils "github.com/sourcenetwork/defradb/tests/integration/collection" - "github.com/stretchr/testify/assert" ) func TestUpdateSaveErrorsGivenUnknownField(t *testing.T) { diff --git a/tests/integration/collection/update/simple/with_filter_test.go b/tests/integration/collection/update/simple/with_filter_test.go index 800cdd99cb..9d51588469 100644 --- a/tests/integration/collection/update/simple/with_filter_test.go +++ b/tests/integration/collection/update/simple/with_filter_test.go @@ -14,9 +14,10 @@ import ( "context" "testing" + "github.com/stretchr/testify/assert" + "github.com/sourcenetwork/defradb/client" testUtils "github.com/sourcenetwork/defradb/tests/integration/collection" - "github.com/stretchr/testify/assert" ) func TestUpdateWithFilter(t *testing.T) { diff --git a/tests/integration/collection/update/simple/with_key_test.go b/tests/integration/collection/update/simple/with_key_test.go index 71e6986263..12a24df0f8 100644 --- a/tests/integration/collection/update/simple/with_key_test.go +++ b/tests/integration/collection/update/simple/with_key_test.go @@ -14,9 +14,10 @@ import ( "context" "testing" + "github.com/stretchr/testify/assert" + "github.com/sourcenetwork/defradb/client" testUtils "github.com/sourcenetwork/defradb/tests/integration/collection" - "github.com/stretchr/testify/assert" ) func TestUpdateWithKey(t *testing.T) { diff --git a/tests/integration/collection/update/simple/with_keys_test.go b/tests/integration/collection/update/simple/with_keys_test.go index 118b8629c5..8aece14158 100644 --- a/tests/integration/collection/update/simple/with_keys_test.go +++ b/tests/integration/collection/update/simple/with_keys_test.go @@ -14,9 +14,10 @@ import ( "context" "testing" + "github.com/stretchr/testify/assert" + "github.com/sourcenetwork/defradb/client" testUtils "github.com/sourcenetwork/defradb/tests/integration/collection" - "github.com/stretchr/testify/assert" ) func TestUpdateWithKeys(t *testing.T) { diff --git a/tests/integration/collection/utils.go b/tests/integration/collection/utils.go index cbee567689..d65947b387 100644 --- a/tests/integration/collection/utils.go +++ b/tests/integration/collection/utils.go @@ -15,10 +15,11 @@ import ( "strings" "testing" + "github.com/stretchr/testify/assert" + "github.com/sourcenetwork/defradb/client" "github.com/sourcenetwork/defradb/errors" testUtils "github.com/sourcenetwork/defradb/tests/integration" - "github.com/stretchr/testify/assert" ) type TestCase struct { diff --git a/tests/integration/net/utils.go b/tests/integration/net/utils.go index 6d479ada83..ce90989cdb 100644 --- a/tests/integration/net/utils.go +++ b/tests/integration/net/utils.go @@ -18,6 +18,9 @@ import ( "sync" "testing" + "github.com/stretchr/testify/assert" + "github.com/textileio/go-threads/broadcast" + "github.com/sourcenetwork/defradb/client" "github.com/sourcenetwork/defradb/config" coreDB "github.com/sourcenetwork/defradb/db" @@ -26,8 +29,6 @@ import ( netutils "github.com/sourcenetwork/defradb/net/utils" "github.com/sourcenetwork/defradb/node" testutils "github.com/sourcenetwork/defradb/tests/integration" - "github.com/stretchr/testify/assert" - "github.com/textileio/go-threads/broadcast" ) var ( diff --git a/tests/integration/schema/utils.go b/tests/integration/schema/utils.go index 81b30f9e54..3027cbc693 100644 --- a/tests/integration/schema/utils.go +++ b/tests/integration/schema/utils.go @@ -15,10 +15,11 @@ import ( "strings" "testing" + "github.com/stretchr/testify/assert" + "github.com/sourcenetwork/defradb/client" "github.com/sourcenetwork/defradb/errors" testutils "github.com/sourcenetwork/defradb/tests/integration" - "github.com/stretchr/testify/assert" ) type QueryTestCase struct { diff --git a/tools/configs/golangci.yaml b/tools/configs/golangci.yaml index 910ffca691..59de3580a2 100644 --- a/tools/configs/golangci.yaml +++ b/tools/configs/golangci.yaml @@ -120,6 +120,7 @@ linters: - goconst - gofmt - goheader + - goimports - gosimple - govet - ineffassign @@ -191,8 +192,6 @@ issues: #==================================================================[ All Settings Of Specific Linters We Have Enabled] linters-settings: - - errcheck: # report about not checking of errors in type assertions: `a := b.(MyStruct)`; # default is false: such cases aren't reported by default. @@ -209,7 +208,6 @@ linters-settings: # - io.Copy(*bytes.Buffer) # - io.Copy(os.Stdout) - forbidigo: # Forbid the following identifiers (identifiers are written using regexp): forbid: @@ -219,7 +217,6 @@ linters-settings: # Exclude godoc examples from forbidigo checks. exclude_godoc_examples: false - goconst: # Minimal length of string constant. min-len: 2 @@ -239,11 +236,9 @@ linters-settings: # @todo: perhaps in the near future set this to false and resolve the warnings. ignore-calls: true - gofmt: simplify: true - goheader: values: const: @@ -269,6 +264,10 @@ linters-settings: template-path: # also as alternative of directive 'template' you may put the path to file with the template source + goimports: + # Put imports beginning with prefix after 3rd-party packages. + # It's a comma-separated list of prefixes. + local-prefixes: github.com/sourcenetwork/defradb gosimple: # Select the Go version to target. @@ -279,7 +278,6 @@ linters-settings: # - S1038 - Unnecessarily complex way of printing formatted string. Which said # instead of using fmt.Print(fmt.Sprintf(...)), one can use fmt.Printf(...). - govet: # report about shadowed variables check-shadowing: false @@ -305,7 +303,6 @@ linters-settings: disable-all: false - lll: # max line length, lines longer will be reported. # '\t' is counted as 1 character. @@ -313,7 +310,6 @@ linters-settings: # tab width in spaces. tab-width: 1 - nolintlint: # Disable to ensure that all nolint directives actually have an effect. allow-unused: false @@ -326,7 +322,6 @@ linters-settings: # Enable to require nolint directives to mention the specific linter being suppressed. require-specific: true - revive: # see https://github.com/mgechev/revive#available-rules for details. ignore-generated-header: true @@ -337,26 +332,22 @@ linters-settings: - name: use-any severity: error - staticcheck: # Select the Go version to target. go: "1.18" # https://staticcheck.io/docs/options#checks checks: ["all"] - unused: # Select the Go version to target. go: "1.18" - whitespace: # Enforces newlines (or comments) after every multi-line if statement. multi-if: false # Enforces newlines (or comments) after every multi-line function signature. multi-func: false - # The custom section can be used to define linter plugins to be loaded at runtime. # See README doc for more info. custom: