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

feat: fix imports #283

Closed
wants to merge 3 commits into from
Closed
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
3 changes: 2 additions & 1 deletion e2e/tests/session_steps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ import (
"time"

abci "github.com/cometbft/cometbft/abci/types"
"github.com/stretchr/testify/require"

"github.com/pokt-network/poktroll/pkg/client/events"
"github.com/pokt-network/poktroll/pkg/either"
"github.com/pokt-network/poktroll/pkg/observable"
"github.com/pokt-network/poktroll/pkg/observable/channel"
"github.com/pokt-network/poktroll/testutil/testclient"
suppliertypes "github.com/pokt-network/poktroll/x/supplier/types"
"github.com/stretchr/testify/require"
)

const (
Expand Down
4 changes: 3 additions & 1 deletion pkg/appgateserver/config/errors.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package config

import sdkerrors "cosmossdk.io/errors"
import (
sdkerrors "cosmossdk.io/errors"
)

var (
codespace = "appgate_config"
Expand Down
4 changes: 3 additions & 1 deletion pkg/appgateserver/errors.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package appgateserver

import sdkerrors "cosmossdk.io/errors"
import (
sdkerrors "cosmossdk.io/errors"
)

var (
codespace = "appgateserver"
Expand Down
1 change: 1 addition & 0 deletions pkg/client/events/replay_client_example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"

"cosmossdk.io/depinject"

"github.com/pokt-network/poktroll/pkg/client/events"
"github.com/pokt-network/poktroll/pkg/observable"
"github.com/pokt-network/poktroll/pkg/polylog"
Expand Down
10 changes: 6 additions & 4 deletions pkg/client/keyring/errors.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
package keyring

import "cosmossdk.io/errors"
import (
sdkerrors "cosmossdk.io/errors"
)

var (
// ErrEmptySigningKeyName represents an error which indicates that the
// provided signing key name is empty or unspecified.
ErrEmptySigningKeyName = errors.Register(codespace, 1, "empty signing key name")
ErrEmptySigningKeyName = sdkerrors.Register(codespace, 1, "empty signing key name")

// ErrNoSuchSigningKey represents an error signifying that the requested
// signing key does not exist or could not be located.
ErrNoSuchSigningKey = errors.Register(codespace, 2, "signing key does not exist")
ErrNoSuchSigningKey = sdkerrors.Register(codespace, 2, "signing key does not exist")

// ErrSigningKeyAddr is raised when there's a failure in retrieving the
// associated address for the provided signing key.
ErrSigningKeyAddr = errors.Register(codespace, 3, "failed to get address for signing key")
ErrSigningKeyAddr = sdkerrors.Register(codespace, 3, "failed to get address for signing key")

codespace = "keyring"
)
5 changes: 3 additions & 2 deletions pkg/client/supplier/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@ import (

"cosmossdk.io/depinject"
"github.com/golang/mock/gomock"
"github.com/pokt-network/smt"
"github.com/stretchr/testify/require"

"github.com/pokt-network/poktroll/pkg/client/keyring"
"github.com/pokt-network/poktroll/pkg/client/supplier"
"github.com/pokt-network/poktroll/testutil/mockclient"
"github.com/pokt-network/poktroll/testutil/testclient/testkeyring"
"github.com/pokt-network/poktroll/testutil/testclient/testtx"
sessiontypes "github.com/pokt-network/poktroll/x/session/types"
sharedtypes "github.com/pokt-network/poktroll/x/shared/types"
"github.com/pokt-network/smt"
"github.com/stretchr/testify/require"
)

const (
Expand Down
3 changes: 1 addition & 2 deletions pkg/client/tx/client_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ import (
"github.com/cosmos/cosmos-sdk/types"
"github.com/stretchr/testify/require"

"github.com/pokt-network/poktroll/pkg/client"
"github.com/pokt-network/poktroll/pkg/client/tx"
"github.com/pokt-network/poktroll/testutil/testclient/testblock"
"github.com/pokt-network/poktroll/testutil/testclient/testeventsquery"
"github.com/pokt-network/poktroll/testutil/testclient/testkeyring"
"github.com/pokt-network/poktroll/testutil/testclient/testtx"

"github.com/pokt-network/poktroll/pkg/client"
apptypes "github.com/pokt-network/poktroll/x/application/types"
)

Expand Down
18 changes: 10 additions & 8 deletions pkg/client/tx/errors.go
Original file line number Diff line number Diff line change
@@ -1,41 +1,43 @@
package tx

import errorsmod "cosmossdk.io/errors"
import (
sdkerrors "cosmossdk.io/errors"
)

var (
// ErrInvalidMsg signifies that there was an issue in validating the
// transaction message. This could be due to format, content, or other
// constraints imposed on the message.
ErrInvalidMsg = errorsmod.Register(codespace, 4, "failed to validate tx message")
ErrInvalidMsg = sdkerrors.Register(codespace, 4, "failed to validate tx message")

// ErrCheckTx indicates an error occurred during the ABCI check transaction
// process, which verifies the transaction's integrity before it is added
// to the mempool.
ErrCheckTx = errorsmod.Register(codespace, 5, "error during ABCI check tx")
ErrCheckTx = sdkerrors.Register(codespace, 5, "error during ABCI check tx")

// ErrTxTimeout is raised when a transaction has taken too long to
// complete, surpassing a predefined threshold.
ErrTxTimeout = errorsmod.Register(codespace, 6, "tx timed out")
ErrTxTimeout = sdkerrors.Register(codespace, 6, "tx timed out")

// ErrQueryTx indicates an error occurred while trying to query for the status
// of a specific transaction, likely due to issues with the query parameters
// or the state of the blockchain network.
ErrQueryTx = errorsmod.Register(codespace, 7, "error encountered while querying for tx")
ErrQueryTx = sdkerrors.Register(codespace, 7, "error encountered while querying for tx")

// ErrInvalidTxHash represents an error which is triggered when the
// transaction hash provided does not adhere to the expected format or
// constraints, implying it may be corrupted or tampered with.
ErrInvalidTxHash = errorsmod.Register(codespace, 8, "invalid tx hash")
ErrInvalidTxHash = sdkerrors.Register(codespace, 8, "invalid tx hash")

// ErrNonTxEventBytes indicates an attempt to deserialize bytes that do not
// correspond to a transaction event. This error is triggered when the provided
// byte data isn't recognized as a valid transaction event representation.
ErrNonTxEventBytes = errorsmod.Register(codespace, 9, "attempted to deserialize non-tx event bytes")
ErrNonTxEventBytes = sdkerrors.Register(codespace, 9, "attempted to deserialize non-tx event bytes")

// ErrUnmarshalTx signals a failure in the unmarshaling process of a transaction.
// This error is triggered when the system encounters issues translating a set of
// bytes into the corresponding Tx structure or object.
ErrUnmarshalTx = errorsmod.Register(codespace, 10, "failed to unmarshal tx")
ErrUnmarshalTx = sdkerrors.Register(codespace, 10, "failed to unmarshal tx")

codespace = "tx_client"
)
3 changes: 2 additions & 1 deletion pkg/deps/config/suppliers.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
cosmosflags "github.com/cosmos/cosmos-sdk/client/flags"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
grpc "github.com/cosmos/gogoproto/grpc"
"github.com/spf13/cobra"

"github.com/pokt-network/poktroll/pkg/client/block"
"github.com/pokt-network/poktroll/pkg/client/events"
"github.com/pokt-network/poktroll/pkg/client/query"
Expand All @@ -17,7 +19,6 @@ import (
"github.com/pokt-network/poktroll/pkg/crypto/rings"
"github.com/pokt-network/poktroll/pkg/polylog"
"github.com/pokt-network/poktroll/pkg/sdk"
"github.com/spf13/cobra"
)

// SupplierFn is a function that is used to supply a depinject config.
Expand Down
6 changes: 4 additions & 2 deletions pkg/observable/errors.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package observable

import errorsmod "cosmossdk.io/errors"
import (
sdkerrors "cosmossdk.io/errors"
)

var (
ErrObserverClosed = errorsmod.Register(codespace, 1, "observer is closed")
ErrObserverClosed = sdkerrors.Register(codespace, 1, "observer is closed")
codespace = "observable"
)
4 changes: 3 additions & 1 deletion pkg/observable/interface.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package observable

import "context"
import (
"context"
)

// NOTE: We explicitly decided to write a small and custom notifications package
// to keep logic simple and minimal. If the needs & requirements of this library ever
Expand Down
4 changes: 3 additions & 1 deletion pkg/polylog/context.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package polylog

import "context"
import (
"context"
)

// CtxKey is the key used to store the polylog.Logger in a context.Context. This
// is **independant** of any logger-implementation-specific context key that may
Expand Down
4 changes: 3 additions & 1 deletion pkg/relayer/config/errors.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package config

import sdkerrors "cosmossdk.io/errors"
import (
sdkerrors "cosmossdk.io/errors"
)

var (
codespace = "relayminer_config"
Expand Down
4 changes: 3 additions & 1 deletion pkg/relayer/miner/gen/template.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package main

import "text/template"
import (
"text/template"
)

var (
relayFixtureLineFmt = "\t\t\"%x\","
Expand Down
6 changes: 4 additions & 2 deletions pkg/relayer/protocol/errors.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package protocol

import errorsmod "cosmossdk.io/errors"
import (
sdkerrors "cosmossdk.io/errors"
)

var (
ErrDifficulty = errorsmod.New(codespace, 1, "difficulty error")
ErrDifficulty = sdkerrors.New(codespace, 1, "difficulty error")
codespace = "relayer/protocol"
)
4 changes: 3 additions & 1 deletion pkg/relayer/session/errors.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package session

import sdkerrors "cosmossdk.io/errors"
import (
sdkerrors "cosmossdk.io/errors"
)

var (
codespace = "relayer_session"
Expand Down
4 changes: 3 additions & 1 deletion pkg/sdk/errors.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package sdk

import sdkerrors "cosmossdk.io/errors"
import (
sdkerrors "cosmossdk.io/errors"
)

var (
codespace = "poktrollsdk"
Expand Down
4 changes: 3 additions & 1 deletion pkg/sdk/urls.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package sdk

import "fmt"
import (
"fmt"
)

// HostToWebsocketURL converts the provided host into a websocket URL that can
// be used to subscribe to onchain events and query the chain via a client
Expand Down
4 changes: 3 additions & 1 deletion pkg/signer/simple_signer.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package signer

import "github.com/cosmos/cosmos-sdk/crypto/keyring"
import (
"github.com/cosmos/cosmos-sdk/crypto/keyring"
)

var _ Signer = (*SimpleSigner)(nil)

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

import errorsmod "cosmossdk.io/errors"
import (
sdkerrors "cosmossdk.io/errors"
)

var (
// ErrAsync is returned when a test assertion fails in a goroutine other than
// the main test goroutine. This is done to avoid concurrent usage of
// t.Fatal() which can cause the test binary to exit before cleanup is complete.
ErrAsync = errorsmod.Register(codespace, 1, "required assertion failed")
ErrAsync = sdkerrors.Register(codespace, 1, "required assertion failed")
codespace = "testerrors"
)
4 changes: 3 additions & 1 deletion testutil/yaml/yaml.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package yaml

import "strings"
import (
"strings"
)

// YAML is indentation sensitive, so we need to remove the extra indentation from the test cases and make sure
// it is space-indented instead of tab-indented, otherwise the YAML parser will fail
Expand Down
35 changes: 35 additions & 0 deletions tools/scripts/goimports-revisor.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env bash

FLAGS=(
-rm-unused
-use-cache
-imports-order "std,general,company,project,blanked,dotted"
-project-name "github.com/pokt-network/poktrolld"
)

# Define a function to check for the exclusion comment and run goimports-reviser
process_file() {
local file=$1
if ! grep -q "//go:build ignore" "$file"; then
echo "Processing $file"
goimports-reviser "${FLAGS[@]}" "$file"
fi
}

export -f process_file

# Find all .go files, excluding specified patterns, and process them
find . -type f -name '*.go' \
! -path "./vendors/*" \
! -path "./ts-client/*" \
! -path "./.git/*" \
! -path "./.github/*" \
! -path "./bin/*" \
! -path "./docs/*" \
! -path "./localnet/*" \
! -path "./proto/*" \
! -path "./tools/*" \
! -name "*mock.go" \
! -name "*pb.go" \
-exec bash -c 'process_file "$0"' {} \;

6 changes: 1 addition & 5 deletions x/application/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@ package cli

import (
"fmt"
// "strings"

"github.com/spf13/cobra"

"github.com/cosmos/cosmos-sdk/client"
// "github.com/cosmos/cosmos-sdk/client/flags"
// sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/spf13/cobra"

"github.com/pokt-network/poktroll/x/application/types"
)
Expand Down
3 changes: 1 addition & 2 deletions x/application/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ import (
"fmt"
"time"

"github.com/cosmos/cosmos-sdk/client"
"github.com/spf13/cobra"

"github.com/cosmos/cosmos-sdk/client"
// "github.com/cosmos/cosmos-sdk/client/flags"
"github.com/pokt-network/poktroll/x/application/types"
)

Expand Down
4 changes: 2 additions & 2 deletions x/application/client/cli/tx_undelegate_from_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package cli
import (
"strconv"

"github.com/pokt-network/poktroll/x/application/types"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
"github.com/spf13/cobra"

"github.com/pokt-network/poktroll/x/application/types"
)

var _ = strconv.Itoa(0)
Expand Down
4 changes: 3 additions & 1 deletion x/application/client/config/errors.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package config

import sdkerrors "cosmossdk.io/errors"
import (
sdkerrors "cosmossdk.io/errors"
)

var (
codespace = "applicationconfig"
Expand Down
Loading
Loading