Skip to content

Commit

Permalink
chore: Fix linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ValentinTrinque committed Feb 22, 2024
1 parent 948a61c commit a4d8972
Show file tree
Hide file tree
Showing 78 changed files with 4,351 additions and 123 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Setup Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: '1.21.5'
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v3.7.0
with:
version: v1.53.2
args: --config .golangci.yaml --verbose
version: v1.55.2
args: --config .golangci.toml --verbose
env:
GO111MODULE: on
40 changes: 40 additions & 0 deletions .golangci.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
[run]
allow-parallel-runners = true
print-linter-name = true
timeout = '15m0s'

[output]
print-issued-lines = true
format = "colored-line-number"

[issues]
max-issues-per-linter = 0
max-same-issues = 0
exclude = [
"Error return value of .(.*MarkFlagRequired). is not checked"
]

[linters]
disable-all = true
enable = [
"errcheck",
"gosimple",
"govet",
"ineffassign",
"staticcheck",
"typecheck",
"unused",
"nilerr",
"misspell",
"gci"
]

[linters-settings.gci]
custom-order = true
sections = [
"standard", # Standard section: captures all standard packages.
"prefix(code.vegaprotocol.io/vega)", # Custom section: groups all imports with the specified Prefix.
"default", # Default section: contains all imports that could not be matched to another section type.
"blank", # Blank section: contains all blank imports. This section is not present unless explicitly enabled.
"dot",
]
34 changes: 0 additions & 34 deletions .golangci.yaml

This file was deleted.

1 change: 1 addition & 0 deletions cmd/docs/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"strings"

"code.vegaprotocol.io/vegacapsule/docsgenerator"

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

Expand Down
1 change: 1 addition & 0 deletions cmd/ethereum.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"code.vegaprotocol.io/vegacapsule/state"
"code.vegaprotocol.io/vegacapsule/types"
"code.vegaprotocol.io/vegacapsule/utils"

"github.com/spf13/cobra"
)

Expand Down
1 change: 0 additions & 1 deletion cmd/ethereum_asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"time"

vgtypes "github.com/ethereum/go-ethereum/core/types"

"github.com/spf13/cobra"
)

Expand Down
15 changes: 7 additions & 8 deletions cmd/ethereum_asset_deposit.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import (
"fmt"
"math/big"

vgethereum "code.vegaprotocol.io/shared/libs/ethereum"
vgethereum "code.vegaprotocol.io/vegacapsule/libs/ethereum"
"code.vegaprotocol.io/vegacapsule/state"

"github.com/ethereum/go-ethereum/common"
"github.com/spf13/cobra"
)
Expand All @@ -20,13 +21,11 @@ type ethereumAssetDepositOrStakeArgs struct {
networkAddress string
}

var (
ethereumAssetDepositFlags = struct {
vegaPubKey string
assetSymbol string
amount int64
}{}
)
var ethereumAssetDepositFlags = struct {
vegaPubKey string
assetSymbol string
amount int64
}{}

func init() {
ethereumAssetDepositCmd.Flags().StringVar(&ethereumAssetDepositFlags.assetSymbol, "asset-symbol", "", "symbol of the asset to be deposited")
Expand Down
15 changes: 7 additions & 8 deletions cmd/ethereum_asset_mint.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import (
"fmt"
"math/big"

vgethereum "code.vegaprotocol.io/shared/libs/ethereum"
vgethereum "code.vegaprotocol.io/vegacapsule/libs/ethereum"
"code.vegaprotocol.io/vegacapsule/state"

"github.com/ethereum/go-ethereum/common"
"github.com/spf13/cobra"
)
Expand All @@ -19,13 +20,11 @@ type ethereumAssetMintArgs struct {
networkAddress string
}

var (
ethereumAssetMintFlags = struct {
toAddress string
assetSymbol string
amount int64
}{}
)
var ethereumAssetMintFlags = struct {
toAddress string
assetSymbol string
amount int64
}{}

func init() {
ethereumAssetMintCmd.Flags().StringVar(&ethereumAssetMintFlags.assetSymbol, "asset-symbol", "", "symbol of the asset to be minted")
Expand Down
15 changes: 7 additions & 8 deletions cmd/ethereum_asset_stake.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,18 @@ import (
"fmt"
"math/big"

vgethereum "code.vegaprotocol.io/shared/libs/ethereum"
vgethereum "code.vegaprotocol.io/vegacapsule/libs/ethereum"
"code.vegaprotocol.io/vegacapsule/state"

"github.com/ethereum/go-ethereum/common"
"github.com/spf13/cobra"
)

var (
ethereumAssetStakeFlags = struct {
vegaPubKey string
assetSymbol string
amount int64
}{}
)
var ethereumAssetStakeFlags = struct {
vegaPubKey string
assetSymbol string
amount int64
}{}

func init() {
ethereumAssetStakeCmd.Flags().StringVar(&ethereumAssetStakeFlags.assetSymbol, "asset-symbol", "", "symbol of the asset to be staked")
Expand Down
4 changes: 2 additions & 2 deletions cmd/install_dependencies.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import (
"fmt"
"os"

"github.com/spf13/cobra"

"code.vegaprotocol.io/vegacapsule/config"
"code.vegaprotocol.io/vegacapsule/installer"
"code.vegaprotocol.io/vegacapsule/utils"

"github.com/spf13/cobra"
)

const (
Expand Down
1 change: 1 addition & 0 deletions cmd/jobs_start.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"code.vegaprotocol.io/vegacapsule/config"
"code.vegaprotocol.io/vegacapsule/nomad"
"code.vegaprotocol.io/vegacapsule/state"

"github.com/spf13/cobra"
)

Expand Down
1 change: 1 addition & 0 deletions cmd/jobs_stop.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

"code.vegaprotocol.io/vegacapsule/nomad"
"code.vegaprotocol.io/vegacapsule/state"

"github.com/spf13/cobra"
)

Expand Down
1 change: 1 addition & 0 deletions cmd/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

"code.vegaprotocol.io/vegacapsule/logscollector"
"code.vegaprotocol.io/vegacapsule/state"

"github.com/spf13/cobra"
)

Expand Down
1 change: 1 addition & 0 deletions cmd/network_addresses.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"code.vegaprotocol.io/vegacapsule/ports"
"code.vegaprotocol.io/vegacapsule/state"
"code.vegaprotocol.io/vegacapsule/types"

"github.com/spf13/cobra"
)

Expand Down
1 change: 1 addition & 0 deletions cmd/network_bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"code.vegaprotocol.io/vegacapsule/installer"
"code.vegaprotocol.io/vegacapsule/state"
"code.vegaprotocol.io/vegacapsule/types"

"github.com/spf13/cobra"
)

Expand Down
1 change: 1 addition & 0 deletions cmd/network_destroy.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"code.vegaprotocol.io/vegacapsule/nomad"
"code.vegaprotocol.io/vegacapsule/state"

"github.com/spf13/cobra"
)

Expand Down
1 change: 1 addition & 0 deletions cmd/network_generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"code.vegaprotocol.io/vegacapsule/state"
"code.vegaprotocol.io/vegacapsule/types"
"code.vegaprotocol.io/vegacapsule/utils"

"github.com/spf13/cobra"
)

Expand Down
5 changes: 2 additions & 3 deletions cmd/network_keys_import.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"code.vegaprotocol.io/vegacapsule/importer"
"code.vegaprotocol.io/vegacapsule/state"

"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -48,9 +49,7 @@ Example content of the file with data to import:
...
]`

var (
keysFilePath string
)
var keysFilePath string

var netKeysImportCmd = &cobra.Command{
Use: "import",
Expand Down
1 change: 1 addition & 0 deletions cmd/network_logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"code.vegaprotocol.io/vegacapsule/nomad"
"code.vegaprotocol.io/vegacapsule/state"
"code.vegaprotocol.io/vegacapsule/types"

"github.com/spf13/cobra"
)

Expand Down
5 changes: 2 additions & 3 deletions cmd/network_start.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ import (
"code.vegaprotocol.io/vegacapsule/config"
"code.vegaprotocol.io/vegacapsule/nomad"
"code.vegaprotocol.io/vegacapsule/state"

"github.com/spf13/cobra"
)

var (
doNotStopAllJobsOnFailure bool
)
var doNotStopAllJobsOnFailure bool

var netStartCmd = &cobra.Command{
Use: "start",
Expand Down
5 changes: 2 additions & 3 deletions cmd/network_stop.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ import (

"code.vegaprotocol.io/vegacapsule/nomad"
"code.vegaprotocol.io/vegacapsule/state"

"github.com/spf13/cobra"
)

var (
stopNodesOnly bool
)
var stopNodesOnly bool

var netStopCmd = &cobra.Command{
Use: "stop",
Expand Down
3 changes: 2 additions & 1 deletion cmd/nodes_add.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"code.vegaprotocol.io/vegacapsule/nomad"
"code.vegaprotocol.io/vegacapsule/state"
"code.vegaprotocol.io/vegacapsule/types"

"github.com/spf13/cobra"
"golang.org/x/sync/errgroup"
)
Expand Down Expand Up @@ -89,7 +90,7 @@ var nodesAddCmd = &cobra.Command{

fmt.Println(string(outputStringJSON))
if resultsOutPath != "" {
if err := os.WriteFile(resultsOutPath, outputStringJSON, 0666); err != nil {
if err := os.WriteFile(resultsOutPath, outputStringJSON, 0o666); err != nil {
return fmt.Errorf("failed to save results about new nodes into the file: %w", err)
}
}
Expand Down
1 change: 1 addition & 0 deletions cmd/nodes_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"

"code.vegaprotocol.io/vegacapsule/state"

"github.com/spf13/cobra"
)

Expand Down
1 change: 1 addition & 0 deletions cmd/nodes_list_validators.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"

"code.vegaprotocol.io/vegacapsule/state"

"github.com/spf13/cobra"
)

Expand Down
1 change: 1 addition & 0 deletions cmd/nodes_protocol_upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"code.vegaprotocol.io/vegacapsule/generator/visor"
"code.vegaprotocol.io/vegacapsule/state"
"code.vegaprotocol.io/vegacapsule/types"

"github.com/spf13/cobra"
)

Expand Down
6 changes: 4 additions & 2 deletions cmd/nodes_remove.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package cmd

import (
"context"
"fmt"

"code.vegaprotocol.io/vegacapsule/generator"
"code.vegaprotocol.io/vegacapsule/nomad"
"code.vegaprotocol.io/vegacapsule/state"
"context"
"fmt"

"github.com/spf13/cobra"
)

Expand Down
1 change: 1 addition & 0 deletions cmd/nodes_reset_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

"code.vegaprotocol.io/vegacapsule/commands"
"code.vegaprotocol.io/vegacapsule/state"

"github.com/spf13/cobra"
)

Expand Down
Loading

0 comments on commit a4d8972

Please sign in to comment.