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

chore: make format the whole repo #1516

Open
wants to merge 2 commits into
base: v0.34.x-celestia
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,8 @@ clean_certs:
###############################################################################

format:
find . -name '*.go' -type f -not -path "*.git*" -not -name '*.pb.go' -not -name '*pb_test.go' | xargs gofmt -w -s
find . -name '*.go' -type f -not -path "*.git*" -not -name '*.pb.go' -not -name '*pb_test.go' | xargs goimports -w -local github.com/cometbft/cometbft
@echo "--> Running golangci-lint --fix"
@golangci-lint run --fix
.PHONY: format

lint:
Expand Down
3 changes: 2 additions & 1 deletion blockchain/v2/reactor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ import (
"testing"
"time"

dbm "github.com/cometbft/cometbft-db"
"github.com/gogo/protobuf/proto"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

dbm "github.com/cometbft/cometbft-db"

Comment on lines 15 to +17
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[observation] make format runs:

	find . -name '*.go' -type f -not -path "*.git*" -not -name '*.pb.go' -not -name '*pb_test.go' | xargs gofmt -w -s
	find . -name '*.go' -type f -not -path "*.git*"  -not -name '*.pb.go' -not -name '*pb_test.go' | xargs goimports -w -local github.com/cometbft/cometbft

even though golangci.yml doesn't have any rules to special case the order of imports for github.com/cometbft/cometbft. In other words, this PR seems fine to me but a future contributor can accidentally modify the order of imports and we won't get signal on it.

IMO the order of imports isn't important so I propose we modify the Makefile to do this:

fmt:
	@echo "--> Running golangci-lint --fix"
	@golangci-lint run --fix

and then re-run make format to fix the issues that golangci.yml has identified and can fix.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/behaviour"
cfg "github.com/tendermint/tendermint/config"
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,9 +5,10 @@ import (
"fmt"
"strings"

dbm "github.com/cometbft/cometbft-db"
"github.com/spf13/cobra"

dbm "github.com/cometbft/cometbft-db"

abcitypes "github.com/tendermint/tendermint/abci/types"
cmtcfg "github.com/tendermint/tendermint/config"
"github.com/tendermint/tendermint/libs/progressbar"
Expand Down
3 changes: 2 additions & 1 deletion consensus/replay_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ import (
"testing"
"time"

dbm "github.com/cometbft/cometbft-db"
"github.com/gogo/protobuf/proto"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

dbm "github.com/cometbft/cometbft-db"

"github.com/tendermint/tendermint/abci/example/kvstore"
abci "github.com/tendermint/tendermint/abci/types"
cfg "github.com/tendermint/tendermint/config"
Expand Down
3 changes: 2 additions & 1 deletion evidence/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ import (
"sync/atomic"
"time"

dbm "github.com/cometbft/cometbft-db"
"github.com/gogo/protobuf/proto"
gogotypes "github.com/gogo/protobuf/types"

dbm "github.com/cometbft/cometbft-db"

clist "github.com/tendermint/tendermint/libs/clist"
"github.com/tendermint/tendermint/libs/log"
cmtproto "github.com/tendermint/tendermint/proto/tendermint/types"
Expand Down
3 changes: 2 additions & 1 deletion node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ import (
"strings"
"time"

dbm "github.com/cometbft/cometbft-db"
"github.com/grafana/pyroscope-go"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/rs/cors"
sdktrace "go.opentelemetry.io/otel/sdk/trace"

dbm "github.com/cometbft/cometbft-db"

abci "github.com/tendermint/tendermint/abci/types"
bcv0 "github.com/tendermint/tendermint/blockchain/v0"
bcv1 "github.com/tendermint/tendermint/blockchain/v1"
Expand Down
3 changes: 2 additions & 1 deletion p2p/trust/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import (
"os"
"testing"

dbm "github.com/cometbft/cometbft-db"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

dbm "github.com/cometbft/cometbft-db"

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

Expand Down
6 changes: 3 additions & 3 deletions proto/tendermint/abci/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ message RequestListSnapshots {}

// offers a snapshot to the application
message RequestOfferSnapshot {
Snapshot snapshot = 1; // snapshot offered by peers
bytes app_hash = 2; // light client-verified app hash for snapshot height
uint64 app_version = 3; // The application version at which the snapshot was taken
Snapshot snapshot = 1; // snapshot offered by peers
bytes app_hash = 2; // light client-verified app hash for snapshot height
uint64 app_version = 3; // The application version at which the snapshot was taken
}

// loads a snapshot chunk
Expand Down
8 changes: 4 additions & 4 deletions proto/tendermint/store/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ message BlockStoreState {
// TxInfo describes the location of a tx inside a committed block
// as well as the result of executing the transaction and the error log output.
message TxInfo {
int64 height = 1;
uint32 index = 2;
int64 height = 1;
uint32 index = 2;
// The response code of executing the tx. 0 means
// successfully executed, all others are error codes.
uint32 code = 3;
uint32 code = 3;
// The error log output generated if the transaction execution fails.
string error = 4;
string error = 4;
}
3 changes: 2 additions & 1 deletion rpc/core/blocks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

dbm "github.com/cometbft/cometbft-db"
"github.com/tendermint/tendermint/crypto/merkle"
"github.com/tendermint/tendermint/libs/pubsub/query"
cmtrand "github.com/tendermint/tendermint/libs/rand"
"github.com/tendermint/tendermint/types"

dbm "github.com/cometbft/cometbft-db"

abci "github.com/tendermint/tendermint/abci/types"
cmtstate "github.com/tendermint/tendermint/proto/tendermint/state"
cmtstore "github.com/tendermint/tendermint/proto/tendermint/store"
Expand Down
3 changes: 2 additions & 1 deletion state/execution_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"

db "github.com/cometbft/cometbft-db"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/crypto/ed25519"
Expand All @@ -35,6 +34,8 @@ import (
"github.com/tendermint/tendermint/types"
cmttime "github.com/tendermint/tendermint/types/time"
"github.com/tendermint/tendermint/version"

db "github.com/cometbft/cometbft-db"
)

var (
Expand Down
3 changes: 2 additions & 1 deletion state/indexer/block/kv/kv.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ import (
"strconv"
"strings"

dbm "github.com/cometbft/cometbft-db"
"github.com/google/orderedcode"

dbm "github.com/cometbft/cometbft-db"

abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/pubsub/query"
"github.com/tendermint/tendermint/state/indexer"
Expand Down
3 changes: 2 additions & 1 deletion state/indexer/block/kv/kv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import (
"fmt"
"testing"

db "github.com/cometbft/cometbft-db"
"github.com/stretchr/testify/require"

db "github.com/cometbft/cometbft-db"

abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/pubsub/query"
blockidxkv "github.com/tendermint/tendermint/state/indexer/block/kv"
Expand Down
3 changes: 2 additions & 1 deletion state/rollback_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import (
"crypto/rand"
"testing"

dbm "github.com/cometbft/cometbft-db"
"github.com/stretchr/testify/require"

dbm "github.com/cometbft/cometbft-db"

"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/crypto/tmhash"
cmtstate "github.com/tendermint/tendermint/proto/tendermint/state"
Expand Down
3 changes: 2 additions & 1 deletion state/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import (
"errors"
"fmt"

dbm "github.com/cometbft/cometbft-db"
"github.com/gogo/protobuf/proto"

dbm "github.com/cometbft/cometbft-db"

abci "github.com/tendermint/tendermint/abci/types"
cmtmath "github.com/tendermint/tendermint/libs/math"
cmtos "github.com/tendermint/tendermint/libs/os"
Expand Down
3 changes: 2 additions & 1 deletion state/txindex/indexer_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import (
"testing"
"time"

db "github.com/cometbft/cometbft-db"
"github.com/stretchr/testify/require"

db "github.com/cometbft/cometbft-db"

abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/log"
blockidxkv "github.com/tendermint/tendermint/state/indexer/block/kv"
Expand Down
3 changes: 2 additions & 1 deletion state/txindex/kv/kv.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ import (
"strconv"
"strings"

dbm "github.com/cometbft/cometbft-db"
"github.com/gogo/protobuf/proto"

dbm "github.com/cometbft/cometbft-db"

abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/pubsub/query"
"github.com/tendermint/tendermint/state/indexer"
Expand Down
3 changes: 2 additions & 1 deletion store/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import (
"fmt"
"strconv"

dbm "github.com/cometbft/cometbft-db"
"github.com/gogo/protobuf/proto"

dbm "github.com/cometbft/cometbft-db"

abci "github.com/tendermint/tendermint/abci/types"
cmtsync "github.com/tendermint/tendermint/libs/sync"
cmtstore "github.com/tendermint/tendermint/proto/tendermint/store"
Expand Down
3 changes: 2 additions & 1 deletion store/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ import (
"testing"
"time"

dbm "github.com/cometbft/cometbft-db"
"github.com/gogo/protobuf/proto"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

dbm "github.com/cometbft/cometbft-db"

abci "github.com/tendermint/tendermint/abci/types"
cfg "github.com/tendermint/tendermint/config"
"github.com/tendermint/tendermint/crypto"
Expand Down
3 changes: 2 additions & 1 deletion test/loadtime/cmd/load/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package main
import (
"fmt"

"github.com/cometbft/cometbft-load-test/pkg/loadtest"
"github.com/google/uuid"

"github.com/cometbft/cometbft-load-test/pkg/loadtest"

"github.com/tendermint/tendermint/test/loadtime/payload"
)

Expand Down
Loading