Lint imports

This commit is contained in:
Kirill Fedoseev 2022-05-22 15:29:01 +04:00
parent 9270c9911c
commit b3cc0be853
36 changed files with 124 additions and 91 deletions

View File

@ -4,14 +4,15 @@ import (
"context"
"fmt"
"time"
"tokenbridge-monitor/config"
"tokenbridge-monitor/db"
"tokenbridge-monitor/entity"
"tokenbridge-monitor/ethclient"
"tokenbridge-monitor/logging"
"tokenbridge-monitor/repository"
"github.com/sirupsen/logrus"
"github.com/poanetwork/tokenbridge-monitor/config"
"github.com/poanetwork/tokenbridge-monitor/db"
"github.com/poanetwork/tokenbridge-monitor/entity"
"github.com/poanetwork/tokenbridge-monitor/ethclient"
"github.com/poanetwork/tokenbridge-monitor/logging"
"github.com/poanetwork/tokenbridge-monitor/repository"
)
func main() {

View File

@ -5,15 +5,16 @@ import (
"net/http"
"os"
"os/signal"
"tokenbridge-monitor/config"
"tokenbridge-monitor/db"
"tokenbridge-monitor/ethclient"
"tokenbridge-monitor/logging"
"tokenbridge-monitor/monitor"
"tokenbridge-monitor/presenter"
"tokenbridge-monitor/repository"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/poanetwork/tokenbridge-monitor/config"
"github.com/poanetwork/tokenbridge-monitor/db"
"github.com/poanetwork/tokenbridge-monitor/ethclient"
"github.com/poanetwork/tokenbridge-monitor/logging"
"github.com/poanetwork/tokenbridge-monitor/monitor"
"github.com/poanetwork/tokenbridge-monitor/presenter"
"github.com/poanetwork/tokenbridge-monitor/repository"
)
func main() {

View File

@ -3,11 +3,12 @@ package contract
import (
"context"
"fmt"
"tokenbridge-monitor/config"
"tokenbridge-monitor/contract/abi"
"tokenbridge-monitor/ethclient"
"github.com/ethereum/go-ethereum/common"
"github.com/poanetwork/tokenbridge-monitor/config"
"github.com/poanetwork/tokenbridge-monitor/contract/abi"
"github.com/poanetwork/tokenbridge-monitor/ethclient"
)
type BridgeContract struct {

View File

@ -3,12 +3,13 @@ package contract
import (
"context"
"fmt"
"tokenbridge-monitor/entity"
"tokenbridge-monitor/ethclient"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/common"
"github.com/poanetwork/tokenbridge-monitor/entity"
"github.com/poanetwork/tokenbridge-monitor/ethclient"
)
type Contract struct {

View File

@ -2,10 +2,11 @@ package contract
import (
"fmt"
"tokenbridge-monitor/entity"
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/common"
"github.com/poanetwork/tokenbridge-monitor/entity"
)
func Indexed(args abi.Arguments) abi.Arguments {

View File

@ -6,7 +6,6 @@ import (
"fmt"
"runtime"
"strings"
"tokenbridge-monitor/config"
"github.com/golang-migrate/migrate/v4"
_ "github.com/golang-migrate/migrate/v4/database/pgx"
@ -14,6 +13,8 @@ import (
_ "github.com/jackc/pgx/v4/stdlib"
"github.com/jmoiron/sqlx"
_ "github.com/lib/pq"
"github.com/poanetwork/tokenbridge-monitor/config"
)
type DB struct {

2
go.mod
View File

@ -1,4 +1,4 @@
module tokenbridge-monitor
module github.com/poanetwork/tokenbridge-monitor
go 1.17

View File

@ -4,9 +4,10 @@ import (
"context"
"fmt"
"time"
"tokenbridge-monitor/config"
"tokenbridge-monitor/db"
"tokenbridge-monitor/logging"
"github.com/poanetwork/tokenbridge-monitor/config"
"github.com/poanetwork/tokenbridge-monitor/db"
"github.com/poanetwork/tokenbridge-monitor/logging"
)
type AlertManager struct {

View File

@ -4,11 +4,12 @@ import (
"context"
"fmt"
"time"
"tokenbridge-monitor/db"
sq "github.com/Masterminds/squirrel"
"github.com/ethereum/go-ethereum/common"
"github.com/lib/pq"
"github.com/poanetwork/tokenbridge-monitor/db"
)
type DBAlertsProvider struct {

View File

@ -6,11 +6,12 @@ import (
"fmt"
"strconv"
"time"
"tokenbridge-monitor/logging"
"github.com/ethereum/go-ethereum/common"
"github.com/prometheus/client_golang/prometheus"
"github.com/sirupsen/logrus"
"github.com/poanetwork/tokenbridge-monitor/logging"
)
type AlertJobParams struct {

View File

@ -8,14 +8,6 @@ import (
"sort"
"sync"
"time"
"tokenbridge-monitor/config"
"tokenbridge-monitor/contract"
"tokenbridge-monitor/db"
"tokenbridge-monitor/entity"
"tokenbridge-monitor/ethclient"
"tokenbridge-monitor/logging"
"tokenbridge-monitor/repository"
"tokenbridge-monitor/utils"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common"
@ -23,6 +15,15 @@ import (
"github.com/ethereum/go-ethereum/crypto"
"github.com/prometheus/client_golang/prometheus"
"github.com/sirupsen/logrus"
"github.com/poanetwork/tokenbridge-monitor/config"
"github.com/poanetwork/tokenbridge-monitor/contract"
"github.com/poanetwork/tokenbridge-monitor/db"
"github.com/poanetwork/tokenbridge-monitor/entity"
"github.com/poanetwork/tokenbridge-monitor/ethclient"
"github.com/poanetwork/tokenbridge-monitor/logging"
"github.com/poanetwork/tokenbridge-monitor/repository"
"github.com/poanetwork/tokenbridge-monitor/utils"
)
const defaultSyncedThreshold = 10

View File

@ -3,10 +3,11 @@ package monitor
import (
"bytes"
"encoding/binary"
"tokenbridge-monitor/entity"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
"github.com/poanetwork/tokenbridge-monitor/entity"
)
func unmarshalMessage(bridgeID string, direction entity.Direction, encodedData []byte) *entity.Message {

View File

@ -5,15 +5,16 @@ import (
"errors"
"fmt"
"math/big"
"tokenbridge-monitor/config"
"tokenbridge-monitor/contract/abi"
"tokenbridge-monitor/db"
"tokenbridge-monitor/entity"
"tokenbridge-monitor/ethclient"
"tokenbridge-monitor/repository"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
"github.com/poanetwork/tokenbridge-monitor/config"
"github.com/poanetwork/tokenbridge-monitor/contract/abi"
"github.com/poanetwork/tokenbridge-monitor/db"
"github.com/poanetwork/tokenbridge-monitor/entity"
"github.com/poanetwork/tokenbridge-monitor/ethclient"
"github.com/poanetwork/tokenbridge-monitor/repository"
)
type EventHandler func(ctx context.Context, log *entity.Log, data map[string]interface{}) error

View File

@ -3,13 +3,14 @@ package monitor
import (
"context"
"fmt"
"tokenbridge-monitor/config"
"tokenbridge-monitor/contract/abi"
"tokenbridge-monitor/db"
"tokenbridge-monitor/ethclient"
"tokenbridge-monitor/logging"
"tokenbridge-monitor/monitor/alerts"
"tokenbridge-monitor/repository"
"github.com/poanetwork/tokenbridge-monitor/config"
"github.com/poanetwork/tokenbridge-monitor/contract/abi"
"github.com/poanetwork/tokenbridge-monitor/db"
"github.com/poanetwork/tokenbridge-monitor/ethclient"
"github.com/poanetwork/tokenbridge-monitor/logging"
"github.com/poanetwork/tokenbridge-monitor/monitor/alerts"
"github.com/poanetwork/tokenbridge-monitor/repository"
)
type Monitor struct {

View File

@ -2,9 +2,10 @@ package monitor
import (
"math"
"tokenbridge-monitor/entity"
"github.com/ethereum/go-ethereum/common"
"github.com/poanetwork/tokenbridge-monitor/entity"
)
type BlocksRange struct {

View File

@ -2,10 +2,11 @@ package monitor_test
import (
"testing"
"tokenbridge-monitor/entity"
"tokenbridge-monitor/monitor"
"github.com/stretchr/testify/require"
"github.com/poanetwork/tokenbridge-monitor/entity"
"github.com/poanetwork/tokenbridge-monitor/monitor"
)
func TestSplitBlockRange(t *testing.T) {

View File

@ -4,10 +4,11 @@ import (
"fmt"
"net/http"
"time"
"tokenbridge-monitor/logging"
"github.com/go-chi/chi/v5/middleware"
"github.com/sirupsen/logrus"
"github.com/poanetwork/tokenbridge-monitor/logging"
)
func NewRequestLogger(logger logging.Logger) func(next http.Handler) http.Handler {

View File

@ -8,15 +8,16 @@ import (
"net/http"
"regexp"
"strconv"
"tokenbridge-monitor/config"
"tokenbridge-monitor/db"
"tokenbridge-monitor/entity"
"tokenbridge-monitor/logging"
"tokenbridge-monitor/repository"
"github.com/ethereum/go-ethereum/common"
"github.com/go-chi/chi/v5"
"github.com/go-chi/chi/v5/middleware"
"github.com/poanetwork/tokenbridge-monitor/config"
"github.com/poanetwork/tokenbridge-monitor/db"
"github.com/poanetwork/tokenbridge-monitor/entity"
"github.com/poanetwork/tokenbridge-monitor/logging"
"github.com/poanetwork/tokenbridge-monitor/repository"
)
type Presenter struct {

View File

@ -2,10 +2,11 @@ package presenter
import (
"time"
"tokenbridge-monitor/entity"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/poanetwork/tokenbridge-monitor/entity"
)
type MessageInfo struct {

View File

@ -2,7 +2,8 @@ package presenter
import (
"fmt"
"tokenbridge-monitor/entity"
"github.com/poanetwork/tokenbridge-monitor/entity"
)
var formats = map[string]string{

View File

@ -1,7 +1,7 @@
package postgres
import (
"tokenbridge-monitor/db"
"github.com/poanetwork/tokenbridge-monitor/db"
)
type basePostgresRepo struct {

View File

@ -5,10 +5,11 @@ import (
"database/sql"
"errors"
"fmt"
"tokenbridge-monitor/db"
"tokenbridge-monitor/entity"
sq "github.com/Masterminds/squirrel"
"github.com/poanetwork/tokenbridge-monitor/db"
"github.com/poanetwork/tokenbridge-monitor/entity"
)
type blockTimestampsRepo basePostgresRepo

View File

@ -5,11 +5,12 @@ import (
"database/sql"
"errors"
"fmt"
"tokenbridge-monitor/db"
"tokenbridge-monitor/entity"
sq "github.com/Masterminds/squirrel"
"github.com/ethereum/go-ethereum/common"
"github.com/poanetwork/tokenbridge-monitor/db"
"github.com/poanetwork/tokenbridge-monitor/entity"
)
type bridgeValidatorsRepo basePostgresRepo

View File

@ -5,11 +5,12 @@ import (
"database/sql"
"errors"
"fmt"
"tokenbridge-monitor/db"
"tokenbridge-monitor/entity"
sq "github.com/Masterminds/squirrel"
"github.com/ethereum/go-ethereum/common"
"github.com/poanetwork/tokenbridge-monitor/db"
"github.com/poanetwork/tokenbridge-monitor/entity"
)
type collectedMessagesRepo basePostgresRepo

View File

@ -5,11 +5,12 @@ import (
"database/sql"
"errors"
"fmt"
"tokenbridge-monitor/db"
"tokenbridge-monitor/entity"
sq "github.com/Masterminds/squirrel"
"github.com/ethereum/go-ethereum/common"
"github.com/poanetwork/tokenbridge-monitor/db"
"github.com/poanetwork/tokenbridge-monitor/entity"
)
type ercToNativeMessagesRepo basePostgresRepo

View File

@ -5,11 +5,12 @@ import (
"database/sql"
"errors"
"fmt"
"tokenbridge-monitor/db"
"tokenbridge-monitor/entity"
sq "github.com/Masterminds/squirrel"
"github.com/ethereum/go-ethereum/common"
"github.com/poanetwork/tokenbridge-monitor/db"
"github.com/poanetwork/tokenbridge-monitor/entity"
)
type executedInformationRequestsRepo basePostgresRepo

View File

@ -5,11 +5,12 @@ import (
"database/sql"
"errors"
"fmt"
"tokenbridge-monitor/db"
"tokenbridge-monitor/entity"
sq "github.com/Masterminds/squirrel"
"github.com/ethereum/go-ethereum/common"
"github.com/poanetwork/tokenbridge-monitor/db"
"github.com/poanetwork/tokenbridge-monitor/entity"
)
type executedMessagesRepo basePostgresRepo

View File

@ -5,11 +5,12 @@ import (
"database/sql"
"errors"
"fmt"
"tokenbridge-monitor/db"
"tokenbridge-monitor/entity"
sq "github.com/Masterminds/squirrel"
"github.com/ethereum/go-ethereum/common"
"github.com/poanetwork/tokenbridge-monitor/db"
"github.com/poanetwork/tokenbridge-monitor/entity"
)
type informationRequestsRepo basePostgresRepo

View File

@ -3,11 +3,12 @@ package postgres
import (
"context"
"fmt"
"tokenbridge-monitor/db"
"tokenbridge-monitor/entity"
sq "github.com/Masterminds/squirrel"
"github.com/ethereum/go-ethereum/common"
"github.com/poanetwork/tokenbridge-monitor/db"
"github.com/poanetwork/tokenbridge-monitor/entity"
)
type logsRepo basePostgresRepo

View File

@ -5,11 +5,12 @@ import (
"database/sql"
"errors"
"fmt"
"tokenbridge-monitor/db"
"tokenbridge-monitor/entity"
sq "github.com/Masterminds/squirrel"
"github.com/ethereum/go-ethereum/common"
"github.com/poanetwork/tokenbridge-monitor/db"
"github.com/poanetwork/tokenbridge-monitor/entity"
)
type logsCursorsRepo basePostgresRepo

View File

@ -5,11 +5,12 @@ import (
"database/sql"
"errors"
"fmt"
"tokenbridge-monitor/db"
"tokenbridge-monitor/entity"
sq "github.com/Masterminds/squirrel"
"github.com/ethereum/go-ethereum/common"
"github.com/poanetwork/tokenbridge-monitor/db"
"github.com/poanetwork/tokenbridge-monitor/entity"
)
type messagesRepo basePostgresRepo

View File

@ -5,11 +5,12 @@ import (
"database/sql"
"errors"
"fmt"
"tokenbridge-monitor/db"
"tokenbridge-monitor/entity"
sq "github.com/Masterminds/squirrel"
"github.com/ethereum/go-ethereum/common"
"github.com/poanetwork/tokenbridge-monitor/db"
"github.com/poanetwork/tokenbridge-monitor/entity"
)
type sentInformationRequestsRepo basePostgresRepo

View File

@ -5,11 +5,12 @@ import (
"database/sql"
"errors"
"fmt"
"tokenbridge-monitor/db"
"tokenbridge-monitor/entity"
sq "github.com/Masterminds/squirrel"
"github.com/ethereum/go-ethereum/common"
"github.com/poanetwork/tokenbridge-monitor/db"
"github.com/poanetwork/tokenbridge-monitor/entity"
)
type sentMessagesRepo basePostgresRepo

View File

@ -5,11 +5,12 @@ import (
"database/sql"
"errors"
"fmt"
"tokenbridge-monitor/db"
"tokenbridge-monitor/entity"
sq "github.com/Masterminds/squirrel"
"github.com/ethereum/go-ethereum/common"
"github.com/poanetwork/tokenbridge-monitor/db"
"github.com/poanetwork/tokenbridge-monitor/entity"
)
type signedInformationRequestsRepo basePostgresRepo

View File

@ -5,11 +5,12 @@ import (
"database/sql"
"errors"
"fmt"
"tokenbridge-monitor/db"
"tokenbridge-monitor/entity"
sq "github.com/Masterminds/squirrel"
"github.com/ethereum/go-ethereum/common"
"github.com/poanetwork/tokenbridge-monitor/db"
"github.com/poanetwork/tokenbridge-monitor/entity"
)
type signedMessagesRepo basePostgresRepo

View File

@ -1,9 +1,9 @@
package repository
import (
"tokenbridge-monitor/db"
"tokenbridge-monitor/entity"
"tokenbridge-monitor/repository/postgres"
"github.com/poanetwork/tokenbridge-monitor/db"
"github.com/poanetwork/tokenbridge-monitor/entity"
"github.com/poanetwork/tokenbridge-monitor/repository/postgres"
)
type Repo struct {