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

CI: Use deterministic import order linter/formatter (gci) #3734

Closed
wants to merge 10 commits into from
4 changes: 2 additions & 2 deletions .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: reviewdog-golangci-lint
uses: reviewdog/action-golangci-lint@v2
with:
golangci_lint_version: "v1.41.1"
golangci_lint_version: "v1.44.2"
golangci_lint_flags: "-c .golangci.yml --allow-parallel-runners"
reporter: "github-pr-review"
tool_name: "Lint Errors"
Expand Down Expand Up @@ -59,7 +59,7 @@ jobs:
run: |
cd cicdtmp/golangci-lint
git clone https://github.com/golangci/golangci-lint.git .
git checkout tags/v1.41.1
git checkout tags/v1.44.2
CGO_ENABLED=true go build -trimpath -o golangci-lint-cgo ./cmd/golangci-lint
./golangci-lint-cgo --version
cd ../../
Expand Down
12 changes: 12 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@ linters:
- govet
- ineffassign
- misspell
- gci

linters-settings:
gci:
sections:
- standard
- default
- prefix(github.com/algorand)
- prefix(github.com/algorand/go-algorand)

section-separators:
- newLine

severity:
default-severity: error
Expand Down
3 changes: 2 additions & 1 deletion agreement/agreementtest/simulate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ import (
"testing"
"time"

"github.com/algorand/go-deadlock"
"github.com/stretchr/testify/require"

"github.com/algorand/go-deadlock"

"github.com/algorand/go-algorand/agreement"
"github.com/algorand/go-algorand/config"
"github.com/algorand/go-algorand/crypto"
Expand Down
3 changes: 2 additions & 1 deletion agreement/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ import (
"math/rand"
"testing"

"github.com/algorand/go-deadlock"
"github.com/stretchr/testify/require"

"github.com/algorand/go-deadlock"

"github.com/algorand/go-algorand/config"
"github.com/algorand/go-algorand/crypto"
"github.com/algorand/go-algorand/data/basics"
Expand Down
3 changes: 2 additions & 1 deletion agreement/cryptoVerifier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ import (
"testing"
"time"

"github.com/algorand/go-deadlock"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/algorand/go-deadlock"

"github.com/algorand/go-algorand/config"
"github.com/algorand/go-algorand/crypto"
"github.com/algorand/go-algorand/data/account"
Expand Down
1 change: 1 addition & 0 deletions agreement/fuzzer/dropMessageFilter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package fuzzer

import (
"encoding/json"

"github.com/algorand/go-algorand/protocol"
)

Expand Down
3 changes: 2 additions & 1 deletion agreement/fuzzer/ledger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@ import (
"fmt"
"math/rand"

"github.com/algorand/go-deadlock"

"github.com/algorand/go-algorand/agreement"
"github.com/algorand/go-algorand/config"
"github.com/algorand/go-algorand/crypto"
"github.com/algorand/go-algorand/data/basics"
"github.com/algorand/go-algorand/data/bookkeeping"
"github.com/algorand/go-algorand/data/committee"
"github.com/algorand/go-algorand/protocol"
"github.com/algorand/go-deadlock"
)

const randseed = 0
Expand Down
1 change: 1 addition & 0 deletions agreement/fuzzer/messageDecoderFilter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package fuzzer
import (
"bytes"
"encoding/json"

"github.com/algorand/go-deadlock"

//"github.com/algorand/go-algorand/agreement"
Expand Down
1 change: 1 addition & 0 deletions agreement/fuzzer/messageDelayFilter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package fuzzer
import (
"container/heap"
"encoding/json"

"github.com/algorand/go-deadlock"

"github.com/algorand/go-algorand/protocol"
Expand Down
3 changes: 2 additions & 1 deletion agreement/fuzzer/messageDuplicationFilter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ import (
"container/heap"
"encoding/json"

"github.com/algorand/go-algorand/protocol"
"github.com/algorand/go-deadlock"

"github.com/algorand/go-algorand/protocol"
)

// Duplicate message with delay
Expand Down
1 change: 1 addition & 0 deletions agreement/fuzzer/messagePriorityQueue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package fuzzer

import (
"container/heap"

"github.com/algorand/go-algorand/protocol"
)

Expand Down
3 changes: 2 additions & 1 deletion agreement/fuzzer/messageReflectionFilter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ import (
"container/heap"
"encoding/json"

"github.com/algorand/go-algorand/protocol"
"github.com/algorand/go-deadlock"

"github.com/algorand/go-algorand/protocol"
)

// Simulate a 2 way mirror where messages are passed through and also reflected back to sender with a delay
Expand Down
3 changes: 1 addition & 2 deletions agreement/fuzzer/tests_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"math"
"math/rand"
"os"

//ossignal "os/signal"
"path/filepath"
//"runtime/pprof"
Expand All @@ -35,9 +34,9 @@ import (

"github.com/stretchr/testify/require"

"github.com/algorand/go-algorand/logging"
"github.com/algorand/go-deadlock"

"github.com/algorand/go-algorand/logging"
//"github.com/algorand/go-algorand/protocol"
"github.com/algorand/go-algorand/test/partitiontest"
)
Expand Down
3 changes: 2 additions & 1 deletion agreement/msgp_gen.go

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

3 changes: 2 additions & 1 deletion agreement/msgp_gen_test.go

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

3 changes: 2 additions & 1 deletion agreement/proposalManager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ package agreement
import (
"testing"

"github.com/algorand/go-algorand/test/partitiontest"
"github.com/stretchr/testify/require"

"github.com/algorand/go-algorand/test/partitiontest"
)

// Creates a proposal manager, and returns it in automata and white box form, along
Expand Down
3 changes: 2 additions & 1 deletion agreement/proposalTracker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ import (
"sort"
"testing"

"github.com/algorand/go-algorand/test/partitiontest"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/algorand/go-algorand/test/partitiontest"
)

func sortedVoteGen(t *testing.T) (votes []vote) {
Expand Down
3 changes: 2 additions & 1 deletion agreement/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ import (
"testing"
"time"

"github.com/algorand/go-deadlock"
"github.com/stretchr/testify/require"

"github.com/algorand/go-deadlock"

"github.com/algorand/go-algorand/config"
"github.com/algorand/go-algorand/crypto"
"github.com/algorand/go-algorand/data/account"
Expand Down
3 changes: 2 additions & 1 deletion catchup/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ import (
"testing"
"time"

"github.com/algorand/go-deadlock"
"github.com/stretchr/testify/require"

"github.com/algorand/go-deadlock"

"github.com/algorand/go-algorand/agreement"
"github.com/algorand/go-algorand/config"
"github.com/algorand/go-algorand/crypto"
Expand Down
3 changes: 2 additions & 1 deletion cmd/algod/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ import (
"strings"
"time"

"github.com/algorand/go-deadlock"
"github.com/gofrs/flock"

"github.com/algorand/go-deadlock"

"github.com/algorand/go-algorand/config"
"github.com/algorand/go-algorand/crypto"
"github.com/algorand/go-algorand/daemon/algod"
Expand Down
3 changes: 2 additions & 1 deletion cmd/algofix/deadlock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ import (
"strings"
"testing"

"github.com/algorand/go-algorand/test/partitiontest"
"github.com/stretchr/testify/require"

"github.com/algorand/go-algorand/test/partitiontest"
)

const deadlockSimpleSrc = `package main
Expand Down
3 changes: 2 additions & 1 deletion cmd/algoh/blockWatcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ import (
"testing"
"time"

"github.com/stretchr/testify/require"

"github.com/algorand/go-algorand/daemon/algod/api/spec/v1"
"github.com/algorand/go-algorand/test/partitiontest"
"github.com/stretchr/testify/require"
)

func bw(client Client) *blockWatcher {
Expand Down
3 changes: 2 additions & 1 deletion cmd/algoh/blockstats_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ import (
"testing"
"time"

"github.com/stretchr/testify/require"

"github.com/algorand/go-algorand/daemon/algod/api/spec/v1"
"github.com/algorand/go-algorand/logging/telemetryspec"
"github.com/algorand/go-algorand/test/partitiontest"
"github.com/stretchr/testify/require"
)

type event struct {
Expand Down
3 changes: 2 additions & 1 deletion cmd/catchupsrv/download_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ package main
import (
"testing"

"github.com/algorand/go-algorand/test/partitiontest"
"github.com/stretchr/testify/require"

"github.com/algorand/go-algorand/test/partitiontest"
)

func TestBlockToPath(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion cmd/catchupsrv/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ import (
"path"
"strconv"

"github.com/algorand/websocket"
"github.com/gorilla/mux"

"github.com/algorand/websocket"

"github.com/algorand/go-algorand/crypto"
"github.com/algorand/go-algorand/logging"
"github.com/algorand/go-algorand/network"
Expand Down
3 changes: 2 additions & 1 deletion cmd/catchupsrv/tarblocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ import (
"strconv"
"strings"

"github.com/algorand/go-algorand/logging"
"github.com/algorand/go-deadlock"

"github.com/algorand/go-algorand/logging"
)

type tarBlockSet struct {
Expand Down
4 changes: 2 additions & 2 deletions cmd/goal/clerk.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import (
"strings"
"time"

"github.com/spf13/cobra"

"github.com/algorand/go-algorand/config"
"github.com/algorand/go-algorand/crypto"
generatedV2 "github.com/algorand/go-algorand/daemon/algod/api/server/v2/generated"
Expand All @@ -37,8 +39,6 @@ import (
"github.com/algorand/go-algorand/data/transactions/verify"
"github.com/algorand/go-algorand/libgoal"
"github.com/algorand/go-algorand/protocol"

"github.com/spf13/cobra"
)

var (
Expand Down
5 changes: 2 additions & 3 deletions cmd/goal/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,10 @@ import (
"github.com/spf13/cobra/doc"
"golang.org/x/crypto/ssh/terminal"

algodclient "github.com/algorand/go-algorand/daemon/algod/api/client"
kmdclient "github.com/algorand/go-algorand/daemon/kmd/client"

"github.com/algorand/go-algorand/config"
algodclient "github.com/algorand/go-algorand/daemon/algod/api/client"
"github.com/algorand/go-algorand/daemon/algod/api/spec/common"
kmdclient "github.com/algorand/go-algorand/daemon/kmd/client"
"github.com/algorand/go-algorand/data/bookkeeping"
"github.com/algorand/go-algorand/data/transactions"
"github.com/algorand/go-algorand/libgoal"
Expand Down
3 changes: 2 additions & 1 deletion cmd/goal/commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ import (
"os"
"testing"

"github.com/algorand/go-algorand/test/partitiontest"
"github.com/stretchr/testify/require"

"github.com/algorand/go-algorand/test/partitiontest"
)

func TestEnsureDataDirReturnsWhenDataDirIsProvided(t *testing.T) {
Expand Down
3 changes: 2 additions & 1 deletion cmd/goal/formatting_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ package main
import (
"testing"

"github.com/algorand/go-algorand/test/partitiontest"
"github.com/stretchr/testify/require"

"github.com/algorand/go-algorand/test/partitiontest"
)

func TestUnicodePrintable(t *testing.T) {
Expand Down
3 changes: 1 addition & 2 deletions cmd/goal/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@ import (

"github.com/spf13/cobra"

generatedV2 "github.com/algorand/go-algorand/daemon/algod/api/server/v2/generated"

"github.com/algorand/go-algorand/config"
generatedV2 "github.com/algorand/go-algorand/daemon/algod/api/server/v2/generated"
"github.com/algorand/go-algorand/ledger/ledgercore"
"github.com/algorand/go-algorand/libgoal"
"github.com/algorand/go-algorand/network"
Expand Down
4 changes: 2 additions & 2 deletions cmd/goal/tealsign.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ import (
"encoding/base64"
"io/ioutil"

"github.com/spf13/cobra"

"github.com/algorand/go-algorand/crypto"
"github.com/algorand/go-algorand/data/basics"
"github.com/algorand/go-algorand/data/transactions"
"github.com/algorand/go-algorand/data/transactions/logic"
"github.com/algorand/go-algorand/protocol"

"github.com/spf13/cobra"
)

var (
Expand Down
Loading