8000 feat: custom dependencies order by melekes · Pull Request #1994 · cometbft/cometbft · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: custom dependencies order #1994

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

Merged
merged 5 commits into from
Jan 8, 2024
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: 9 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ linters:
- structcheck
- tagliatelle
- typecheck
# Prefer unparam over revive's unused param. It is more thorough in its checking.
- unparam
- varcheck
- varnamelen
Expand Down Expand Up @@ -76,10 +77,16 @@ linters-settings:
max-blank-identifiers: 3
goconst:
ignore-tests: true
maligned:
suggest-new: true
misspell:
locale: US
gci:
sections:
- standard # Standard section: captures all standard packages.
- default # Default section: contains all imports that could not be matched to another section type.
- blank # blank imports
- dot # dot imports
- prefix(github.com/cometbft/cometbft, github.com/cometbft/cometbft-db)
custom-order: true
depguard:
rules:
main:
Expand Down
5 changes: 3 additions & 2 deletions abci/client/grpc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ import (
"sync"
"time"

"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"

"github.com/cometbft/cometbft/abci/types"
cmtnet "github.com/cometbft/cometbft/internal/net"
"github.com/cometbft/cometbft/internal/service"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
)

var _ Client = (*grpcClient)(nil)
Expand Down
9 changes: 5 additions & 4 deletions abci/client/grpc_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ import (
"testing"
"time"

abciserver "github.com/cometbft/cometbft/abci/server"
"github.com/cometbft/cometbft/abci/types"
cmtnet "github.com/cometbft/cometbft/internal/net"
"github.com/cometbft/cometbft/libs/log"
"github.com/stretchr/testify/require"
"golang.org/x/net/context"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"

abciserver "github.com/cometbft/cometbft/abci/server"
"github.com/cometbft/cometbft/abci/types"
cmtnet "github.com/cometbft/cometbft/internal/net"
"github.com/cometbft/cometbft/libs/log"
)

func TestGRPC(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion abci/client/socket_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ import (
"testing"
"time"

"github.com/stretchr/testify/require"

abcicli "github.com/cometbft/cometbft/abci/client"
"github.com/cometbft/cometbft/abci/server"
"github.com/cometbft/cometbft/abci/types"
cmtrand "github.com/cometbft/cometbft/internal/rand"
"github.com/cometbft/cometbft/internal/service"
"github.com/stretchr/testify/require"
)

func TestCalls(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion abci/cmd/abci-cli/abci-cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
"os"
"strings"

"github.com/spf13/cobra"

abcicli "github.com/cometbft/cometbft/abci/client"
"github.com/cometbft/cometbft/abci/example/kvstore"
"github.com/cometbft/cometbft/abci/server"
Expand All @@ -18,7 +20,6 @@ import (
crypto "github.com/cometbft/cometbft/api/cometbft/crypto/v1"
cmtos "github.com/cometbft/cometbft/internal/os"
"github.com/cometbft/cometbft/libs/log"
"github.com/spf13/cobra"
)

// client is a global variable so it can be reused by the console.
Expand Down
3 changes: 2 additions & 1 deletion abci/example/kvstore/kvstore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ import (
"sort"
"testing"

"github.com/stretchr/testify/require"

abcicli "github.com/cometbft/cometbft/abci/client"
abciserver "github.com/cometbft/cometbft/abci/server"
"github.com/cometbft/cometbft/abci/types"
"github.com/cometbft/cometbft/libs/log"
"github.com/stretchr/testify/require"
)

const (
Expand Down
3 changes: 2 additions & 1 deletion abci/server/grpc_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import (
"context"
"net"

"google.golang.org/grpc"

"github.com/cometbft/cometbft/abci/types"
cmtnet "github.com/cometbft/cometbft/internal/net"
"github.com/cometbft/cometbft/internal/service"
"google.golang.org/grpc"
)

type GRPCServer struct {
Expand Down
3 changes: 2 additions & 1 deletion abci/tests/client_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package tests
import (
"testing"

"github.com/stretchr/testify/require"

abciclient "github.com/cometbft/cometbft/abci/client"
"github.com/cometbft/cometbft/abci/example/kvstore"
abciserver "github.com/cometbft/cometbft/abci/server"
"github.com/stretchr/testify/require"
)

func TestClientServerNoAddrPrefix(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion abci/types/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import (
"io"
"math"

"github.com/cosmos/gogoproto/proto"

pb "github.com/cometbft/cometbft/api/cometbft/abci/v1"
"github.com/cometbft/cometbft/internal/protoio"
"github.com/cosmos/gogoproto/proto"
)

const (
Expand Down
3 changes: 2 additions & 1 deletion abci/types/messages_test.go
10000
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ import (
"strings"
"testing"

cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1"
"github.com/cosmos/gogoproto/proto"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1"
)

func TestMarshalJSON(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion abci/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ package types
import (
"encoding/json"

v1 "github.com/cometbft/cometbft/api/cometbft/abci/v1"
"github.com/cosmos/gogoproto/grpc"

v1 "github.com/cometbft/cometbft/api/cometbft/abci/v1"
)

type (
Expand Down
5 changes: 3 additions & 2 deletions abci/types/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package types_test
import (
"testing"

abci "github.com/cometbft/cometbft/abci/types"
"github.com/cometbft/cometbft/crypto/merkle"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

abci "github.com/cometbft/cometbft/abci/types"
"github.com/cometbft/cometbft/crypto/merkle"
)

func TestHashAndProveResults(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion cmd/cometbft/commands/compact.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ import (
"path/filepath"
"sync"

"github.com/cometbft/cometbft/libs/log"
"github.com/spf13/cobra"
"github.com/syndtr/goleveldb/leveldb"
"github.com/syndtr/goleveldb/leveldb/opt"
"github.com/syndtr/goleveldb/leveldb/util"

"github.com/cometbft/cometbft/libs/log"
)

var CompactGoLevelDBCmd = &cobra.Command{
Expand Down
3 changes: 2 additions & 1 deletion cmd/cometbft/commands/debug/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ package debug
import (
"os"

"github.com/cometbft/cometbft/libs/log"
"github.com/spf13/cobra"

"github.com/cometbft/cometbft/libs/log"
)

var (
Expand Down
5 changes: 3 additions & 2 deletions cmd/cometbft/commands/debug/dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ import (
"path/filepath"
"time"

"github.com/spf13/cobra"
"github.com/spf13/viper"

cfg "github.com/cometbft/cometbft/config"
"github.com/cometbft/cometbft/libs/cli"
rpchttp "github.com/cometbft/cometbft/rpc/client/http"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)

var dumpCmd = &cobra.Command{
Expand Down
5 changes: 3 additions & 2 deletions cmd/cometbft/commands/debug/kill.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ import (
"syscall"
"time"

"github.com/spf13/cobra"
"github.com/spf13/viper"

cfg "github.com/cometbft/cometbft/config"
"github.com/cometbft/cometbft/libs/cli"
rpchttp "github.com/cometbft/cometbft/rpc/client/http"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)

var killCmd = &cobra.Command{
Expand Down
3 changes: 2 additions & 1 deletion cmd/cometbft/commands/gen_node_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package commands
import (
"fmt"

"github.com/spf13/cobra"

cmtos "github.com/cometbft/cometbft/internal/os"
"github.com/cometbft/cometbft/p2p"
"github.com/spf13/cobra"
)

// GenNodeKeyCmd allows the generation of a node key. It prints node's ID to
Expand Down
3 changes: 2 additions & 1 deletion cmd/cometbft/commands/gen_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package commands
import (
"fmt"

"github.com/spf13/cobra"

cmtjson "github.com/cometbft/cometbft/libs/json"
"github.com/cometbft/cometbft/privval"
"github.com/spf13/cobra"
)

// GenValidatorCmd allows the generation of a keypair for a
Expand Down
3 changes: 2 additions & 1 deletion cmd/cometbft/commands/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ package commands
import (
"fmt"

"github.com/spf13/cobra"

cfg "github.com/cometbft/cometbft/config"
cmtos "github.com/cometbft/cometbft/internal/os"
cmtrand "github.com/cometbft/cometbft/internal/rand"
"github.com/cometbft/cometbft/p2p"
"github.com/cometbft/cometbft/privval"
"github.com/cometbft/cometbft/types"
cmttime "github.com/cometbft/cometbft/types/time"
"github.com/spf13/cobra"
)

// InitFilesCmd initializes a fresh CometBFT instance.
Expand Down
3 changes: 2 additions & 1 deletion cmd/cometbft/commands/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ import (
"os/signal"
"syscall"

"github.com/spf13/cobra"

cfg "github.com/cometbft/cometbft/config"
"github.com/cometbft/cometbft/internal/inspect"
"github.com/cometbft/cometbft/internal/state"
"github.com/cometbft/cometbft/internal/state/indexer/block"
"github.com/cometbft/cometbft/internal/store"
"github.com/cometbft/cometbft/types"
"github.com/spf13/cobra"
)

// InspectCmd is the command for starting an inspect server.
Expand Down
3 changes: 2 additions & 1 deletion cmd/cometbft/commands/light.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import (
"strings"
"time"

"github.com/spf13/cobra"

dbm "github.com/cometbft/cometbft-db"
cmtos "github.com/cometbft/cometbft/internal/os"
"github.com/cometbft/cometbft/libs/log"
Expand All @@ -20,7 +22,6 @@ import (
lrpc "github.com/cometbft/cometbft/light/rpc"
dbs "github.com/cometbft/cometbft/light/store/db"
rpcserver "github.com/cometbft/cometbft/rpc/jsonrpc/server"
"github.com/spf13/cobra"
)

// LightCmd represents the base command when called without any subcommands.
Expand Down
3 changes: 2 additions & 1 deletion cmd/cometbft/commands/reindex_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
"fmt"
"strings"

"github.com/spf13/cobra"

dbm "github.com/cometbft/cometbft-db"
abcitypes "github.com/cometbft/cometbft/abci/types"
cmtcfg "github.com/cometbft/cometbft/config"
Expand All @@ -16,7 +18,6 @@ import (
"github.com/cometbft/cometbft/internal/state/txindex"
"github.com/cometbft/cometbft/internal/state/txindex/kv"
"github.com/cometbft/cometbft/types"
"github.com/spf13/cobra"
)

const (
Expand Down
7 changes: 4 additions & 3 deletions cmd/cometbft/commands/reindex_event_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ import (
"errors"
"testing"

"github.com/spf13/cobra"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"

dbm "github.com/cometbft/cometbft-db"
abcitypes "github.com/cometbft/cometbft/abci/types"
cmtcfg "github.com/cometbft/cometbft/config"
Expand All @@ -13,9 +17,6 @@ import (
txmocks "github.com/cometbft/cometbft/internal/state/txindex/mocks"
"github.com/cometbft/cometbft/internal/test"
"github.com/cometbft/cometbft/types"
"github.com/spf13/cobra"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
)

const (
Expand Down
3 changes: 2 additions & 1 deletion cmd/cometbft/commands/reset.go
10000
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import (
"os"
"path/filepath"

"github.com/spf13/cobra"

cmtos "github.com/cometbft/cometbft/internal/os"
"github.com/cometbft/cometbft/libs/log"
"github.com/cometbft/cometbft/privval"
"github.com/spf13/cobra"
)

// ResetAllCmd removes the database of this CometBFT core
Expand Down
3 changes: 2 additions & 1 deletion cmd/cometbft/commands/reset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import (
"path/filepath"
"testing"

"github.com/stretchr/testify/require"

cfg "github.com/cometbft/cometbft/config"
"github.com/cometbft/cometbft/privval"
"github.com/stretchr/testify/require"
)

func Test_ResetAll(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion cmd/cometbft/commands/rollback.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import (
"fmt"
"path/filepath"

"github.com/spf13/cobra"

dbm "github.com/cometbft/cometbft-db"
cfg "github.com/cometbft/cometbft/config"
"github.com/cometbft/cometbft/internal/os"
"github.com/cometbft/cometbft/internal/state"
"github.com/cometbft/cometbft/internal/store"
"github.com/spf13/cobra"
)

var removeBlock = false
Expand Down
Loading
0