Skip to content

Commit

Permalink
chore: Add goimports linter for consistent imports ordering (sourcene…
Browse files Browse the repository at this point in the history
  • Loading branch information
orpheuslummis authored Sep 18, 2022
1 parent 1e7f830 commit 50c9ffa
Show file tree
Hide file tree
Showing 96 changed files with 223 additions and 190 deletions.
1 change: 1 addition & 0 deletions api/http/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (

"github.com/go-chi/chi/v5"
"github.com/pkg/errors"

"github.com/sourcenetwork/defradb/client"
)

Expand Down
3 changes: 2 additions & 1 deletion api/http/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions api/http/handlerfuncs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
5 changes: 3 additions & 2 deletions api/http/handlerfuncs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion api/http/logger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion cli/blocks_get.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
3 changes: 2 additions & 1 deletion cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 2 additions & 1 deletion cli/dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
3 changes: 2 additions & 1 deletion cli/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions cli/peerid.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
4 changes: 2 additions & 2 deletions cli/peerid_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion cli/ping.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
5 changes: 3 additions & 2 deletions cli/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion cli/serverdump.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 9 additions & 9 deletions cli/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion cli/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions client/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions client/dockey.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions client/document.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions cmd/genclidocs/genclidocs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
3 changes: 2 additions & 1 deletion cmd/genmanpages/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
3 changes: 2 additions & 1 deletion config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
1 change: 1 addition & 0 deletions core/crdt/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions core/crdt/base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"testing"

ds "github.com/ipfs/go-datastore"

"github.com/sourcenetwork/defradb/core"
"github.com/sourcenetwork/defradb/datastore"
)
Expand Down
8 changes: 4 additions & 4 deletions core/crdt/composite.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
10 changes: 4 additions & 6 deletions core/crdt/lwwreg.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
9 changes: 4 additions & 5 deletions core/crdt/lwwreg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions core/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
Loading

0 comments on commit 50c9ffa

Please sign in to comment.