From fdc789a18703feff0d6a537f52c0d4128426ebb8 Mon Sep 17 00:00:00 2001 From: Arthur Silva Date: Mon, 14 Jun 2021 15:45:25 -0300 Subject: [PATCH] Normalize imports. (#628) --- iap/iap.go | 3 ++- migrate/migrate.go | 9 ++++----- server/api_account.go | 1 + server/api_authenticate.go | 3 +-- server/api_channel.go | 1 + server/api_event.go | 1 + server/api_friend.go | 3 ++- server/api_group.go | 1 + server/api_leaderboard.go | 2 +- server/api_link.go | 1 + server/api_match.go | 1 + server/api_purchase.go | 1 + server/api_session.go | 4 ++-- server/api_storage.go | 3 +-- server/api_tournament.go | 5 ++--- server/api_unlink.go | 1 + server/api_user.go | 1 + server/console.go | 6 ++---- server/console_account.go | 10 ++++------ server/console_api_explorer.go | 9 +++++---- server/console_authenticate.go | 6 ++---- server/console_leaderboard.go | 1 + server/console_match.go | 3 ++- server/console_purchase.go | 1 + server/console_runtime.go | 1 + server/console_status.go | 3 ++- server/console_storage.go | 2 +- server/console_storage_import.go | 4 ++-- server/console_unlink.go | 1 + server/core_account.go | 5 +++-- server/core_channel.go | 4 ++-- server/core_friend.go | 7 +++---- server/core_group.go | 9 ++++----- server/core_leaderboard.go | 4 ++-- server/core_notification.go | 4 ++-- server/core_purchase.go | 9 +++++---- server/core_session.go | 2 +- server/core_storage.go | 7 +++---- server/core_tournament.go | 4 ++-- server/core_unlink.go | 5 +++-- server/core_user.go | 2 +- server/core_wallet.go | 2 +- server/db.go | 1 + server/db_error.go | 1 + server/leaderboard_rank_cache.go | 6 ++---- server/leaderboard_scheduler.go | 1 - server/match_handler.go | 2 +- server/matchmaker.go | 12 ++++++------ server/metrics.go | 3 +-- server/pipeline_channel.go | 4 ++-- server/pipeline_match.go | 2 +- server/pipeline_status.go | 2 +- server/runtime.go | 6 ++---- server/runtime_event.go | 1 + server/runtime_go.go | 4 +--- server/runtime_go_logger.go | 5 +++-- server/runtime_go_nakama.go | 4 ++-- server/runtime_javascript.go | 11 ++++++----- server/runtime_javascript_init.go | 3 +-- server/runtime_javascript_localcache.go | 3 ++- server/runtime_javascript_logger.go | 1 + server/runtime_javascript_nakama.go | 13 ++++++------- server/runtime_lua.go | 3 +-- server/runtime_lua_bit32.go | 2 +- server/runtime_lua_context.go | 2 +- server/runtime_lua_loadlib.go | 2 +- server/runtime_lua_nakama.go | 9 ++++----- server/runtime_lua_oslib.go | 2 +- server/session_registry.go | 5 ++--- server/session_ws.go | 6 ++---- server/status_handler.go | 3 ++- server/tracker.go | 2 +- social/social.go | 2 +- 73 files changed, 138 insertions(+), 137 deletions(-) diff --git a/iap/iap.go b/iap/iap.go index 822b7e72d..da61b8867 100644 --- a/iap/iap.go +++ b/iap/iap.go @@ -23,13 +23,14 @@ import ( "encoding/pem" "errors" "fmt" - "github.com/dgrijalva/jwt-go" "io/ioutil" "net/http" "net/url" "strings" "sync" "time" + + "github.com/dgrijalva/jwt-go" ) const ( diff --git a/migrate/migrate.go b/migrate/migrate.go index 6c9ae9f42..2ecd79ea5 100644 --- a/migrate/migrate.go +++ b/migrate/migrate.go @@ -20,9 +20,6 @@ import ( "errors" "flag" "fmt" - "github.com/jackc/pgconn" - "github.com/jackc/pgerrcode" - _ "github.com/jackc/pgx/v4/stdlib" "io/ioutil" "math" "net/url" @@ -31,11 +28,13 @@ import ( "strings" "time" + "github.com/heroiclabs/nakama/v3/server" + "github.com/jackc/pgconn" + "github.com/jackc/pgerrcode" + _ "github.com/jackc/pgx/v4/stdlib" migrate "github.com/rubenv/sql-migrate" "go.uber.org/zap" "go.uber.org/zap/zapcore" - - "github.com/heroiclabs/nakama/v3/server" ) const ( diff --git a/server/api_account.go b/server/api_account.go index dae04ead4..b6a1991bf 100644 --- a/server/api_account.go +++ b/server/api_account.go @@ -17,6 +17,7 @@ package server import ( "context" "errors" + "github.com/gofrs/uuid" "github.com/heroiclabs/nakama-common/api" "github.com/jackc/pgconn" diff --git a/server/api_authenticate.go b/server/api_authenticate.go index 8ff3efe1b..c83816383 100644 --- a/server/api_authenticate.go +++ b/server/api_authenticate.go @@ -22,11 +22,10 @@ import ( "strings" "time" - "go.uber.org/zap" - "github.com/dgrijalva/jwt-go" "github.com/gofrs/uuid" "github.com/heroiclabs/nakama-common/api" + "go.uber.org/zap" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) diff --git a/server/api_channel.go b/server/api_channel.go index c90229f25..a146b2ab0 100644 --- a/server/api_channel.go +++ b/server/api_channel.go @@ -16,6 +16,7 @@ package server import ( "context" + "github.com/gofrs/uuid" "github.com/heroiclabs/nakama-common/api" "go.uber.org/zap" diff --git a/server/api_event.go b/server/api_event.go index 85c244797..a5301bebb 100644 --- a/server/api_event.go +++ b/server/api_event.go @@ -16,6 +16,7 @@ package server import ( "context" + "github.com/gofrs/uuid" "github.com/heroiclabs/nakama-common/api" "go.uber.org/zap" diff --git a/server/api_friend.go b/server/api_friend.go index a0eda48a6..6462477bf 100644 --- a/server/api_friend.go +++ b/server/api_friend.go @@ -16,13 +16,14 @@ package server import ( "context" + "strconv" + "github.com/gofrs/uuid" "github.com/heroiclabs/nakama-common/api" "go.uber.org/zap" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/emptypb" - "strconv" ) func (s *ApiServer) ListFriends(ctx context.Context, in *api.ListFriendsRequest) (*api.FriendList, error) { diff --git a/server/api_group.go b/server/api_group.go index 2ff902d37..88e0cea9a 100644 --- a/server/api_group.go +++ b/server/api_group.go @@ -16,6 +16,7 @@ package server import ( "context" + "github.com/gofrs/uuid" "github.com/heroiclabs/nakama-common/api" "go.uber.org/zap" diff --git a/server/api_leaderboard.go b/server/api_leaderboard.go index b00afe36f..b0de5eb6f 100644 --- a/server/api_leaderboard.go +++ b/server/api_leaderboard.go @@ -18,7 +18,6 @@ import ( "bytes" "context" "encoding/json" - "google.golang.org/protobuf/types/known/wrapperspb" "github.com/gofrs/uuid" "github.com/heroiclabs/nakama-common/api" @@ -26,6 +25,7 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/emptypb" + "google.golang.org/protobuf/types/known/wrapperspb" ) func (s *ApiServer) DeleteLeaderboardRecord(ctx context.Context, in *api.DeleteLeaderboardRecordRequest) (*emptypb.Empty, error) { diff --git a/server/api_link.go b/server/api_link.go index a969e5157..59fd4e487 100644 --- a/server/api_link.go +++ b/server/api_link.go @@ -16,6 +16,7 @@ package server import ( "context" + "github.com/gofrs/uuid" "github.com/heroiclabs/nakama-common/api" "go.uber.org/zap" diff --git a/server/api_match.go b/server/api_match.go index 553620cc1..62c1acd96 100644 --- a/server/api_match.go +++ b/server/api_match.go @@ -16,6 +16,7 @@ package server import ( "context" + "github.com/gofrs/uuid" "github.com/heroiclabs/nakama-common/api" "go.uber.org/zap" diff --git a/server/api_purchase.go b/server/api_purchase.go index e530d7ee7..3e8ae637a 100644 --- a/server/api_purchase.go +++ b/server/api_purchase.go @@ -16,6 +16,7 @@ package server import ( "context" + "github.com/gofrs/uuid" "github.com/heroiclabs/nakama-common/api" "github.com/heroiclabs/nakama-common/runtime" diff --git a/server/api_session.go b/server/api_session.go index 342ea62c0..d0f96c938 100644 --- a/server/api_session.go +++ b/server/api_session.go @@ -16,13 +16,13 @@ package server import ( "context" - "github.com/gofrs/uuid" - "google.golang.org/protobuf/types/known/emptypb" + "github.com/gofrs/uuid" "github.com/heroiclabs/nakama-common/api" "go.uber.org/zap" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + "google.golang.org/protobuf/types/known/emptypb" ) func (s *ApiServer) SessionRefresh(ctx context.Context, in *api.SessionRefreshRequest) (*api.Session, error) { diff --git a/server/api_storage.go b/server/api_storage.go index b2325a79c..c2ec8328b 100644 --- a/server/api_storage.go +++ b/server/api_storage.go @@ -19,10 +19,9 @@ import ( "context" "encoding/json" - "go.uber.org/zap" - "github.com/gofrs/uuid" "github.com/heroiclabs/nakama-common/api" + "go.uber.org/zap" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/emptypb" diff --git a/server/api_tournament.go b/server/api_tournament.go index 7ca8aa16b..43fd7b6b7 100644 --- a/server/api_tournament.go +++ b/server/api_tournament.go @@ -20,16 +20,15 @@ import ( "encoding/base64" "encoding/gob" "encoding/json" - "google.golang.org/protobuf/types/known/wrapperspb" "time" - "go.uber.org/zap" - "github.com/gofrs/uuid" "github.com/heroiclabs/nakama-common/api" + "go.uber.org/zap" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/emptypb" + "google.golang.org/protobuf/types/known/wrapperspb" ) func (s *ApiServer) JoinTournament(ctx context.Context, in *api.JoinTournamentRequest) (*emptypb.Empty, error) { diff --git a/server/api_unlink.go b/server/api_unlink.go index e44ed6b98..bc707561a 100644 --- a/server/api_unlink.go +++ b/server/api_unlink.go @@ -16,6 +16,7 @@ package server import ( "context" + "github.com/gofrs/uuid" "github.com/heroiclabs/nakama-common/api" "go.uber.org/zap" diff --git a/server/api_user.go b/server/api_user.go index 731de8726..deb5596f8 100644 --- a/server/api_user.go +++ b/server/api_user.go @@ -16,6 +16,7 @@ package server import ( "context" + "github.com/gofrs/uuid" "github.com/heroiclabs/nakama-common/api" "go.uber.org/zap" diff --git a/server/console.go b/server/console.go index c9a599230..3cd779ac2 100644 --- a/server/console.go +++ b/server/console.go @@ -29,18 +29,16 @@ import ( "time" "github.com/dgrijalva/jwt-go" - "google.golang.org/protobuf/encoding/protojson" - "github.com/gorilla/handlers" "github.com/gorilla/mux" grpcgw "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "github.com/heroiclabs/nakama/v3/console" "go.uber.org/zap" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" - - "github.com/heroiclabs/nakama/v3/console" + "google.golang.org/protobuf/encoding/protojson" ) var restrictedMethods = map[string]console.UserRole{ diff --git a/server/console_account.go b/server/console_account.go index 36f3a5031..3f7404e9f 100644 --- a/server/console_account.go +++ b/server/console_account.go @@ -21,21 +21,19 @@ import ( "encoding/base64" "encoding/gob" "encoding/json" - "google.golang.org/protobuf/types/known/timestamppb" "strconv" "strings" - "github.com/jackc/pgtype" - "golang.org/x/crypto/bcrypt" - "github.com/gofrs/uuid" "github.com/heroiclabs/nakama-common/api" + "github.com/heroiclabs/nakama/v3/console" + "github.com/jackc/pgtype" "go.uber.org/zap" + "golang.org/x/crypto/bcrypt" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/emptypb" - - "github.com/heroiclabs/nakama/v3/console" + "google.golang.org/protobuf/types/known/timestamppb" ) type consoleAccountCursor struct { diff --git a/server/console_api_explorer.go b/server/console_api_explorer.go index 7074cd308..b723c1f82 100644 --- a/server/console_api_explorer.go +++ b/server/console_api_explorer.go @@ -4,6 +4,11 @@ import ( "context" "database/sql" "fmt" + "reflect" + "sort" + "strings" + "time" + "github.com/gofrs/uuid" "github.com/heroiclabs/nakama-common/api" "github.com/heroiclabs/nakama/v3/console" @@ -13,10 +18,6 @@ import ( "google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/known/emptypb" - "reflect" - "sort" - "strings" - "time" ) type MethodName string diff --git a/server/console_authenticate.go b/server/console_authenticate.go index c7d27cf3d..98f29856d 100644 --- a/server/console_authenticate.go +++ b/server/console_authenticate.go @@ -16,21 +16,19 @@ package server import ( "context" - "crypto" "database/sql" "errors" "fmt" "time" + "github.com/dgrijalva/jwt-go" + "github.com/heroiclabs/nakama/v3/console" "github.com/jackc/pgtype" "go.uber.org/zap" "golang.org/x/crypto/bcrypt" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - - "github.com/dgrijalva/jwt-go" - "github.com/heroiclabs/nakama/v3/console" ) type ConsoleTokenClaims struct { diff --git a/server/console_leaderboard.go b/server/console_leaderboard.go index d71990e73..9d82a96f9 100644 --- a/server/console_leaderboard.go +++ b/server/console_leaderboard.go @@ -16,6 +16,7 @@ package server import ( "context" + "github.com/gofrs/uuid" "github.com/heroiclabs/nakama-common/api" "github.com/heroiclabs/nakama/v3/console" diff --git a/server/console_match.go b/server/console_match.go index ba56447bb..47af130e2 100644 --- a/server/console_match.go +++ b/server/console_match.go @@ -16,13 +16,14 @@ package server import ( "context" + "strings" + "github.com/gofrs/uuid" "github.com/heroiclabs/nakama-common/api" "github.com/heroiclabs/nakama/v3/console" "go.uber.org/zap" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - "strings" ) func (s *ConsoleServer) ListMatches(ctx context.Context, in *api.ListMatchesRequest) (*api.MatchList, error) { diff --git a/server/console_purchase.go b/server/console_purchase.go index 7ade9f3d1..ad329393d 100644 --- a/server/console_purchase.go +++ b/server/console_purchase.go @@ -16,6 +16,7 @@ package server import ( "context" + "github.com/gofrs/uuid" "github.com/heroiclabs/nakama-common/api" "github.com/heroiclabs/nakama/v3/console" diff --git a/server/console_runtime.go b/server/console_runtime.go index 17b118514..c2d2e5e77 100644 --- a/server/console_runtime.go +++ b/server/console_runtime.go @@ -16,6 +16,7 @@ package server import ( "context" + "github.com/heroiclabs/nakama/v3/console" "google.golang.org/protobuf/types/known/emptypb" "google.golang.org/protobuf/types/known/timestamppb" diff --git a/server/console_status.go b/server/console_status.go index 03d27dcfa..6a0e0e48d 100644 --- a/server/console_status.go +++ b/server/console_status.go @@ -16,13 +16,14 @@ package server import ( "context" + "time" + "github.com/heroiclabs/nakama/v3/console" "go.uber.org/zap" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/emptypb" "google.golang.org/protobuf/types/known/timestamppb" - "time" ) func (s *ConsoleServer) GetStatus(ctx context.Context, in *emptypb.Empty) (*console.StatusList, error) { diff --git a/server/console_storage.go b/server/console_storage.go index 0c3024625..aad4cd650 100644 --- a/server/console_storage.go +++ b/server/console_storage.go @@ -21,7 +21,6 @@ import ( "encoding/base64" "encoding/gob" "encoding/json" - "google.golang.org/protobuf/types/known/timestamppb" "strconv" "sync/atomic" @@ -33,6 +32,7 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/emptypb" + "google.golang.org/protobuf/types/known/timestamppb" ) type consoleStorageCursor struct { diff --git a/server/console_storage_import.go b/server/console_storage_import.go index 07c4bfa55..c573e3cdf 100644 --- a/server/console_storage_import.go +++ b/server/console_storage_import.go @@ -22,8 +22,6 @@ import ( "encoding/json" "errors" "fmt" - "github.com/heroiclabs/nakama/v3/console" - "google.golang.org/protobuf/types/known/wrapperspb" "io" "io/ioutil" "net/http" @@ -32,7 +30,9 @@ import ( "github.com/gofrs/uuid" "github.com/heroiclabs/nakama-common/api" + "github.com/heroiclabs/nakama/v3/console" "go.uber.org/zap" + "google.golang.org/protobuf/types/known/wrapperspb" ) type importStorageObject struct { diff --git a/server/console_unlink.go b/server/console_unlink.go index 8745bf10e..ab70432bc 100644 --- a/server/console_unlink.go +++ b/server/console_unlink.go @@ -16,6 +16,7 @@ package server import ( "context" + "github.com/gofrs/uuid" "github.com/heroiclabs/nakama/v3/console" "go.uber.org/zap" diff --git a/server/core_account.go b/server/core_account.go index 71e3331a8..8a8451655 100644 --- a/server/core_account.go +++ b/server/core_account.go @@ -19,6 +19,9 @@ import ( "database/sql" "encoding/json" "errors" + "strconv" + "strings" + "github.com/gofrs/uuid" "github.com/heroiclabs/nakama-common/api" "github.com/heroiclabs/nakama/v3/console" @@ -29,8 +32,6 @@ import ( "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/timestamppb" "google.golang.org/protobuf/types/known/wrapperspb" - "strconv" - "strings" ) var ErrAccountNotFound = errors.New("account not found") diff --git a/server/core_channel.go b/server/core_channel.go index e9c98eb62..921087113 100644 --- a/server/core_channel.go +++ b/server/core_channel.go @@ -22,8 +22,6 @@ import ( "encoding/gob" "errors" "fmt" - "google.golang.org/protobuf/types/known/timestamppb" - "google.golang.org/protobuf/types/known/wrapperspb" "strings" "time" @@ -31,6 +29,8 @@ import ( "github.com/heroiclabs/nakama-common/api" "github.com/jackc/pgtype" "go.uber.org/zap" + "google.golang.org/protobuf/types/known/timestamppb" + "google.golang.org/protobuf/types/known/wrapperspb" ) var ( diff --git a/server/core_friend.go b/server/core_friend.go index 4f12a763f..293f5e025 100644 --- a/server/core_friend.go +++ b/server/core_friend.go @@ -16,23 +16,22 @@ package server import ( "bytes" + "context" "database/sql" "encoding/base64" "encoding/gob" "encoding/json" "errors" "fmt" - "google.golang.org/protobuf/types/known/timestamppb" - "google.golang.org/protobuf/types/known/wrapperspb" "strconv" "time" - "context" - "github.com/gofrs/uuid" "github.com/heroiclabs/nakama-common/api" "github.com/jackc/pgtype" "go.uber.org/zap" + "google.golang.org/protobuf/types/known/timestamppb" + "google.golang.org/protobuf/types/known/wrapperspb" ) var ErrFriendInvalidCursor = errors.New("friend cursor invalid") diff --git a/server/core_group.go b/server/core_group.go index 83e4913e0..1253a011a 100644 --- a/server/core_group.go +++ b/server/core_group.go @@ -23,21 +23,20 @@ import ( "encoding/json" "errors" "fmt" - "github.com/jackc/pgconn" - "google.golang.org/protobuf/types/known/timestamppb" - "google.golang.org/protobuf/types/known/wrapperspb" "strconv" "strings" "time" - "github.com/heroiclabs/nakama-common/rtapi" - "github.com/gofrs/uuid" "github.com/heroiclabs/nakama-common/api" + "github.com/heroiclabs/nakama-common/rtapi" + "github.com/jackc/pgconn" "github.com/jackc/pgtype" "go.uber.org/zap" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + "google.golang.org/protobuf/types/known/timestamppb" + "google.golang.org/protobuf/types/known/wrapperspb" ) var ( diff --git a/server/core_leaderboard.go b/server/core_leaderboard.go index b3de31475..696a46db0 100644 --- a/server/core_leaderboard.go +++ b/server/core_leaderboard.go @@ -21,8 +21,6 @@ import ( "encoding/base64" "encoding/gob" "errors" - "google.golang.org/protobuf/types/known/timestamppb" - "google.golang.org/protobuf/types/known/wrapperspb" "strconv" "strings" "time" @@ -31,6 +29,8 @@ import ( "github.com/heroiclabs/nakama-common/api" "github.com/jackc/pgtype" "go.uber.org/zap" + "google.golang.org/protobuf/types/known/timestamppb" + "google.golang.org/protobuf/types/known/wrapperspb" ) var ( diff --git a/server/core_notification.go b/server/core_notification.go index 873eaeecf..5ac2d9976 100644 --- a/server/core_notification.go +++ b/server/core_notification.go @@ -20,16 +20,16 @@ import ( "database/sql" "encoding/base64" "encoding/gob" - "google.golang.org/protobuf/types/known/timestamppb" "strconv" "strings" + "time" "github.com/gofrs/uuid" "github.com/heroiclabs/nakama-common/api" "github.com/heroiclabs/nakama-common/rtapi" "github.com/jackc/pgtype" "go.uber.org/zap" - "time" + "google.golang.org/protobuf/types/known/timestamppb" ) const ( diff --git a/server/core_purchase.go b/server/core_purchase.go index 4e622f885..0fe7a1b60 100644 --- a/server/core_purchase.go +++ b/server/core_purchase.go @@ -22,6 +22,11 @@ import ( "encoding/gob" "errors" "fmt" + "net/http" + "strconv" + "strings" + "time" + "github.com/gofrs/uuid" "github.com/heroiclabs/nakama-common/api" "github.com/heroiclabs/nakama-common/runtime" @@ -31,10 +36,6 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "google.golang.org/protobuf/types/known/timestamppb" - "net/http" - "strconv" - "strings" - "time" ) var ErrPurchasesListInvalidCursor = errors.New("purchases list cursor invalid") diff --git a/server/core_session.go b/server/core_session.go index 9245c847a..041f91eb7 100644 --- a/server/core_session.go +++ b/server/core_session.go @@ -18,8 +18,8 @@ import ( "context" "database/sql" "errors" - "github.com/gofrs/uuid" + "github.com/gofrs/uuid" "github.com/jackc/pgtype" "go.uber.org/zap" "google.golang.org/grpc/codes" diff --git a/server/core_storage.go b/server/core_storage.go index 4a72d0e00..928734656 100644 --- a/server/core_storage.go +++ b/server/core_storage.go @@ -16,23 +16,22 @@ package server import ( "bytes" + "context" "crypto/md5" "database/sql" "encoding/base64" "encoding/gob" "errors" "fmt" - "github.com/jackc/pgconn" - "google.golang.org/protobuf/types/known/timestamppb" "sort" - "context" - "github.com/gofrs/uuid" "github.com/heroiclabs/nakama-common/api" + "github.com/jackc/pgconn" "github.com/jackc/pgtype" "go.uber.org/zap" "google.golang.org/grpc/codes" + "google.golang.org/protobuf/types/known/timestamppb" ) var ( diff --git a/server/core_tournament.go b/server/core_tournament.go index 433af9996..0be7c67b8 100644 --- a/server/core_tournament.go +++ b/server/core_tournament.go @@ -22,8 +22,6 @@ import ( "encoding/gob" "errors" "fmt" - "google.golang.org/protobuf/types/known/timestamppb" - "google.golang.org/protobuf/types/known/wrapperspb" "strconv" "strings" "time" @@ -33,6 +31,8 @@ import ( "github.com/heroiclabs/nakama/v3/internal/cronexpr" "github.com/jackc/pgtype" "go.uber.org/zap" + "google.golang.org/protobuf/types/known/timestamppb" + "google.golang.org/protobuf/types/known/wrapperspb" ) var ( diff --git a/server/core_unlink.go b/server/core_unlink.go index 091595291..679e83585 100644 --- a/server/core_unlink.go +++ b/server/core_unlink.go @@ -17,13 +17,14 @@ package server import ( "context" "database/sql" + "strconv" + "strings" + "github.com/gofrs/uuid" "github.com/heroiclabs/nakama/v3/social" "go.uber.org/zap" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - "strconv" - "strings" ) func UnlinkApple(ctx context.Context, logger *zap.Logger, db *sql.DB, config Config, socialClient *social.Client, id uuid.UUID, token string) error { diff --git a/server/core_user.go b/server/core_user.go index c14b845a7..25070e311 100644 --- a/server/core_user.go +++ b/server/core_user.go @@ -17,7 +17,6 @@ package server import ( "context" "database/sql" - "google.golang.org/protobuf/types/known/timestamppb" "strconv" "strings" @@ -25,6 +24,7 @@ import ( "github.com/heroiclabs/nakama-common/api" "github.com/jackc/pgtype" "go.uber.org/zap" + "google.golang.org/protobuf/types/known/timestamppb" ) func GetUsers(ctx context.Context, logger *zap.Logger, db *sql.DB, tracker Tracker, ids, usernames, fbIDs []string) (*api.Users, error) { diff --git a/server/core_wallet.go b/server/core_wallet.go index ccd63ecb2..0ad0b86b7 100644 --- a/server/core_wallet.go +++ b/server/core_wallet.go @@ -23,13 +23,13 @@ import ( "encoding/json" "errors" "fmt" - "github.com/heroiclabs/nakama-common/runtime" "sort" "strconv" "strings" "time" "github.com/gofrs/uuid" + "github.com/heroiclabs/nakama-common/runtime" "github.com/jackc/pgtype" "go.uber.org/zap" ) diff --git a/server/db.go b/server/db.go index 47cbf3798..a08bf87b0 100644 --- a/server/db.go +++ b/server/db.go @@ -18,6 +18,7 @@ import ( "context" "database/sql" "errors" + "github.com/jackc/pgconn" "github.com/jackc/pgerrcode" ) diff --git a/server/db_error.go b/server/db_error.go index e6645634a..aa0dbe7ec 100644 --- a/server/db_error.go +++ b/server/db_error.go @@ -17,6 +17,7 @@ package server import ( "errors" "fmt" + "github.com/jackc/pgerrcode" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" diff --git a/server/leaderboard_rank_cache.go b/server/leaderboard_rank_cache.go index ca95f40c9..1c4c22db5 100644 --- a/server/leaderboard_rank_cache.go +++ b/server/leaderboard_rank_cache.go @@ -19,11 +19,9 @@ import ( "sync" "time" - "github.com/heroiclabs/nakama/v3/internal/skiplist" - - "github.com/heroiclabs/nakama-common/api" - "github.com/gofrs/uuid" + "github.com/heroiclabs/nakama-common/api" + "github.com/heroiclabs/nakama/v3/internal/skiplist" "go.uber.org/zap" ) diff --git a/server/leaderboard_scheduler.go b/server/leaderboard_scheduler.go index bc9ded33d..afb2000d3 100644 --- a/server/leaderboard_scheduler.go +++ b/server/leaderboard_scheduler.go @@ -21,7 +21,6 @@ import ( "time" "go.uber.org/atomic" - "go.uber.org/zap" ) diff --git a/server/match_handler.go b/server/match_handler.go index a1f76ebdd..cdcbb6861 100644 --- a/server/match_handler.go +++ b/server/match_handler.go @@ -18,10 +18,10 @@ import ( "context" "errors" "fmt" - "github.com/heroiclabs/nakama-common/runtime" "time" "github.com/gofrs/uuid" + "github.com/heroiclabs/nakama-common/runtime" "go.uber.org/atomic" "go.uber.org/zap" ) diff --git a/server/matchmaker.go b/server/matchmaker.go index cc699fe7c..968438188 100644 --- a/server/matchmaker.go +++ b/server/matchmaker.go @@ -18,18 +18,18 @@ import ( "context" "errors" "fmt" - "github.com/blevesearch/bleve/v2/index/upsidedown" - "github.com/dgrijalva/jwt-go" - "github.com/heroiclabs/nakama-common/rtapi" - "github.com/heroiclabs/nakama-common/runtime" - "github.com/heroiclabs/nakama/v3/gtreap_compact" - "go.uber.org/atomic" "sync" "time" "github.com/blevesearch/bleve/v2" "github.com/blevesearch/bleve/v2/analysis/analyzer/keyword" + "github.com/blevesearch/bleve/v2/index/upsidedown" + "github.com/dgrijalva/jwt-go" "github.com/gofrs/uuid" + "github.com/heroiclabs/nakama-common/rtapi" + "github.com/heroiclabs/nakama-common/runtime" + "github.com/heroiclabs/nakama/v3/gtreap_compact" + "go.uber.org/atomic" "go.uber.org/zap" ) diff --git a/server/metrics.go b/server/metrics.go index bdc24b7bf..2133d0310 100644 --- a/server/metrics.go +++ b/server/metrics.go @@ -23,11 +23,10 @@ import ( "strings" "time" - "go.uber.org/atomic" - "github.com/gorilla/handlers" "github.com/uber-go/tally" "github.com/uber-go/tally/prometheus" + "go.uber.org/atomic" "go.uber.org/zap" ) diff --git a/server/pipeline_channel.go b/server/pipeline_channel.go index 3b0312e74..17c6cbbbe 100644 --- a/server/pipeline_channel.go +++ b/server/pipeline_channel.go @@ -20,8 +20,6 @@ import ( "encoding/json" "errors" "fmt" - "google.golang.org/protobuf/types/known/timestamppb" - "google.golang.org/protobuf/types/known/wrapperspb" "regexp" "time" "unicode/utf8" @@ -31,6 +29,8 @@ import ( "github.com/heroiclabs/nakama-common/rtapi" "github.com/jackc/pgtype" "go.uber.org/zap" + "google.golang.org/protobuf/types/known/timestamppb" + "google.golang.org/protobuf/types/known/wrapperspb" ) const ( diff --git a/server/pipeline_match.go b/server/pipeline_match.go index 4f66f478d..cfe134393 100644 --- a/server/pipeline_match.go +++ b/server/pipeline_match.go @@ -17,7 +17,6 @@ package server import ( "crypto" "fmt" - "google.golang.org/protobuf/types/known/wrapperspb" "strings" "time" @@ -25,6 +24,7 @@ import ( "github.com/gofrs/uuid" "github.com/heroiclabs/nakama-common/rtapi" "go.uber.org/zap" + "google.golang.org/protobuf/types/known/wrapperspb" ) type matchDataFilter struct { diff --git a/server/pipeline_status.go b/server/pipeline_status.go index 13e0f4042..bf134fe24 100644 --- a/server/pipeline_status.go +++ b/server/pipeline_status.go @@ -15,13 +15,13 @@ package server import ( - "google.golang.org/protobuf/types/known/wrapperspb" "strconv" "strings" "github.com/gofrs/uuid" "github.com/heroiclabs/nakama-common/rtapi" "go.uber.org/zap" + "google.golang.org/protobuf/types/known/wrapperspb" ) func (p *Pipeline) statusFollow(logger *zap.Logger, session Session, envelope *rtapi.Envelope) { diff --git a/server/runtime.go b/server/runtime.go index b05c4882d..e2606e4b3 100644 --- a/server/runtime.go +++ b/server/runtime.go @@ -24,14 +24,12 @@ import ( "sync" "time" - "go.uber.org/atomic" - - "github.com/heroiclabs/nakama-common/runtime" - "github.com/gofrs/uuid" "github.com/heroiclabs/nakama-common/api" "github.com/heroiclabs/nakama-common/rtapi" + "github.com/heroiclabs/nakama-common/runtime" "github.com/heroiclabs/nakama/v3/social" + "go.uber.org/atomic" "go.uber.org/zap" "google.golang.org/grpc/codes" "google.golang.org/protobuf/encoding/protojson" diff --git a/server/runtime_event.go b/server/runtime_event.go index 151a91f44..be92d08dd 100644 --- a/server/runtime_event.go +++ b/server/runtime_event.go @@ -16,6 +16,7 @@ package server import ( "context" + "go.uber.org/zap" ) diff --git a/server/runtime_go.go b/server/runtime_go.go index a70b3b8b5..ea88e6f4e 100644 --- a/server/runtime_go.go +++ b/server/runtime_go.go @@ -18,9 +18,6 @@ import ( "context" "database/sql" "errors" - - "go.uber.org/atomic" - "path/filepath" "plugin" "strings" @@ -31,6 +28,7 @@ import ( "github.com/heroiclabs/nakama-common/rtapi" "github.com/heroiclabs/nakama-common/runtime" "github.com/heroiclabs/nakama/v3/social" + "go.uber.org/atomic" "go.uber.org/zap" "google.golang.org/grpc/codes" "google.golang.org/protobuf/encoding/protojson" diff --git a/server/runtime_go_logger.go b/server/runtime_go_logger.go index 98a0accf3..e3adf6ac7 100644 --- a/server/runtime_go_logger.go +++ b/server/runtime_go_logger.go @@ -16,10 +16,11 @@ package server import ( "fmt" - nkruntime "github.com/heroiclabs/nakama-common/runtime" - "go.uber.org/zap" "runtime" "strings" + + nkruntime "github.com/heroiclabs/nakama-common/runtime" + "go.uber.org/zap" ) type RuntimeGoLogger struct { diff --git a/server/runtime_go_nakama.go b/server/runtime_go_nakama.go index 934f0ef66..a45d6bcd2 100644 --- a/server/runtime_go_nakama.go +++ b/server/runtime_go_nakama.go @@ -23,8 +23,6 @@ import ( "encoding/json" "errors" "fmt" - "google.golang.org/protobuf/types/known/timestamppb" - "google.golang.org/protobuf/types/known/wrapperspb" "os" "strings" "sync" @@ -38,6 +36,8 @@ import ( "github.com/heroiclabs/nakama/v3/social" "go.uber.org/zap" "google.golang.org/protobuf/encoding/protojson" + "google.golang.org/protobuf/types/known/timestamppb" + "google.golang.org/protobuf/types/known/wrapperspb" ) type RuntimeGoNakamaModule struct { diff --git a/server/runtime_javascript.go b/server/runtime_javascript.go index 68e59a17d..3da9a7708 100644 --- a/server/runtime_javascript.go +++ b/server/runtime_javascript.go @@ -20,6 +20,12 @@ import ( "encoding/json" "errors" "fmt" + "io/ioutil" + "os" + "path/filepath" + "sort" + "strings" + "github.com/dop251/goja" "github.com/dop251/goja/ast" "github.com/gofrs/uuid" @@ -32,11 +38,6 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/proto" - "io/ioutil" - "os" - "path/filepath" - "sort" - "strings" ) const JsEntrypointFilename = "index.js" diff --git a/server/runtime_javascript_init.go b/server/runtime_javascript_init.go index 06f2e89b0..4d2f8b389 100644 --- a/server/runtime_javascript_init.go +++ b/server/runtime_javascript_init.go @@ -20,9 +20,8 @@ import ( "strings" "sync" - "github.com/dop251/goja/ast" - "github.com/dop251/goja" + "github.com/dop251/goja/ast" "go.uber.org/zap" ) diff --git a/server/runtime_javascript_localcache.go b/server/runtime_javascript_localcache.go index 95f46715c..5a0597a1c 100644 --- a/server/runtime_javascript_localcache.go +++ b/server/runtime_javascript_localcache.go @@ -15,8 +15,9 @@ package server import ( - "github.com/dop251/goja" "sync" + + "github.com/dop251/goja" ) type RuntimeJavascriptLocalCache struct { diff --git a/server/runtime_javascript_logger.go b/server/runtime_javascript_logger.go index b6dc418e5..87c2bcbe3 100644 --- a/server/runtime_javascript_logger.go +++ b/server/runtime_javascript_logger.go @@ -17,6 +17,7 @@ package server import ( "errors" "fmt" + "github.com/dop251/goja" "go.uber.org/zap" ) diff --git a/server/runtime_javascript_nakama.go b/server/runtime_javascript_nakama.go index b48f08cac..5a4644019 100644 --- a/server/runtime_javascript_nakama.go +++ b/server/runtime_javascript_nakama.go @@ -34,26 +34,25 @@ import ( "encoding/pem" "errors" "fmt" - "github.com/heroiclabs/nakama-common/runtime" - "google.golang.org/protobuf/encoding/protojson" - "google.golang.org/protobuf/types/known/timestamppb" - "google.golang.org/protobuf/types/known/wrapperspb" "io" "io/ioutil" "net/http" "strings" "time" - "github.com/heroiclabs/nakama-common/rtapi" - "github.com/heroiclabs/nakama/v3/internal/cronexpr" - "github.com/dgrijalva/jwt-go" "github.com/dop251/goja" "github.com/gofrs/uuid" "github.com/heroiclabs/nakama-common/api" + "github.com/heroiclabs/nakama-common/rtapi" + "github.com/heroiclabs/nakama-common/runtime" + "github.com/heroiclabs/nakama/v3/internal/cronexpr" "github.com/heroiclabs/nakama/v3/social" "go.uber.org/zap" "golang.org/x/crypto/bcrypt" + "google.golang.org/protobuf/encoding/protojson" + "google.golang.org/protobuf/types/known/timestamppb" + "google.golang.org/protobuf/types/known/wrapperspb" ) type runtimeJavascriptNakamaModule struct { diff --git a/server/runtime_lua.go b/server/runtime_lua.go index bef7aec79..d68bccb4c 100644 --- a/server/runtime_lua.go +++ b/server/runtime_lua.go @@ -28,14 +28,13 @@ import ( "strings" "sync" - "go.uber.org/atomic" - "github.com/gofrs/uuid" "github.com/heroiclabs/nakama-common/api" "github.com/heroiclabs/nakama-common/rtapi" "github.com/heroiclabs/nakama-common/runtime" lua "github.com/heroiclabs/nakama/v3/internal/gopher-lua" "github.com/heroiclabs/nakama/v3/social" + "go.uber.org/atomic" "go.uber.org/zap" "go.uber.org/zap/zapcore" "google.golang.org/grpc/codes" diff --git a/server/runtime_lua_bit32.go b/server/runtime_lua_bit32.go index 22d26e0f0..9499921fe 100644 --- a/server/runtime_lua_bit32.go +++ b/server/runtime_lua_bit32.go @@ -18,7 +18,7 @@ import ( "math" "math/bits" - "github.com/heroiclabs/nakama/v3/internal/gopher-lua" + lua "github.com/heroiclabs/nakama/v3/internal/gopher-lua" ) var ( diff --git a/server/runtime_lua_context.go b/server/runtime_lua_context.go index 67a77ab34..d6ee353e8 100644 --- a/server/runtime_lua_context.go +++ b/server/runtime_lua_context.go @@ -18,7 +18,7 @@ import ( "fmt" "time" - "github.com/heroiclabs/nakama/v3/internal/gopher-lua" + lua "github.com/heroiclabs/nakama/v3/internal/gopher-lua" ) const ( diff --git a/server/runtime_lua_loadlib.go b/server/runtime_lua_loadlib.go index afc9f8f6f..e3686c166 100644 --- a/server/runtime_lua_loadlib.go +++ b/server/runtime_lua_loadlib.go @@ -29,7 +29,7 @@ import ( "path/filepath" "strings" - "github.com/heroiclabs/nakama/v3/internal/gopher-lua" + lua "github.com/heroiclabs/nakama/v3/internal/gopher-lua" ) const emptyLString lua.LString = lua.LString("") diff --git a/server/runtime_lua_nakama.go b/server/runtime_lua_nakama.go index 18b1342df..f8686798c 100644 --- a/server/runtime_lua_nakama.go +++ b/server/runtime_lua_nakama.go @@ -32,9 +32,6 @@ import ( "encoding/json" "encoding/pem" "fmt" - "github.com/heroiclabs/nakama-common/runtime" - "google.golang.org/protobuf/types/known/timestamppb" - "google.golang.org/protobuf/types/known/wrapperspb" "io" "io/ioutil" "net/http" @@ -43,16 +40,18 @@ import ( "time" "github.com/dgrijalva/jwt-go" - "google.golang.org/protobuf/encoding/protojson" - "github.com/gofrs/uuid" "github.com/heroiclabs/nakama-common/api" "github.com/heroiclabs/nakama-common/rtapi" + "github.com/heroiclabs/nakama-common/runtime" "github.com/heroiclabs/nakama/v3/internal/cronexpr" lua "github.com/heroiclabs/nakama/v3/internal/gopher-lua" "github.com/heroiclabs/nakama/v3/social" "go.uber.org/zap" "golang.org/x/crypto/bcrypt" + "google.golang.org/protobuf/encoding/protojson" + "google.golang.org/protobuf/types/known/timestamppb" + "google.golang.org/protobuf/types/known/wrapperspb" ) type ctxLoggerFields struct{} diff --git a/server/runtime_lua_oslib.go b/server/runtime_lua_oslib.go index f611ce761..934704470 100644 --- a/server/runtime_lua_oslib.go +++ b/server/runtime_lua_oslib.go @@ -26,7 +26,7 @@ import ( "strings" "time" - "github.com/heroiclabs/nakama/v3/internal/gopher-lua" + lua "github.com/heroiclabs/nakama/v3/internal/gopher-lua" ) var startedAt time.Time diff --git a/server/session_registry.go b/server/session_registry.go index 2f59a46fb..09eba1f28 100644 --- a/server/session_registry.go +++ b/server/session_registry.go @@ -16,13 +16,12 @@ package server import ( "context" - "github.com/heroiclabs/nakama-common/runtime" "sync" - "go.uber.org/atomic" - "github.com/gofrs/uuid" "github.com/heroiclabs/nakama-common/rtapi" + "github.com/heroiclabs/nakama-common/runtime" + "go.uber.org/atomic" "go.uber.org/zap" ) diff --git a/server/session_ws.go b/server/session_ws.go index 805b59199..37a8e015b 100644 --- a/server/session_ws.go +++ b/server/session_ws.go @@ -18,13 +18,10 @@ import ( "context" "errors" "fmt" + "net" "sync" "time" - "google.golang.org/protobuf/proto" - - "net" - "github.com/gofrs/uuid" "github.com/gorilla/websocket" "github.com/heroiclabs/nakama-common/rtapi" @@ -32,6 +29,7 @@ import ( "go.uber.org/atomic" "go.uber.org/zap" "google.golang.org/protobuf/encoding/protojson" + "google.golang.org/protobuf/proto" ) var ErrSessionQueueFull = errors.New("session outgoing queue full") diff --git a/server/status_handler.go b/server/status_handler.go index c17bf458d..cdc2d5327 100644 --- a/server/status_handler.go +++ b/server/status_handler.go @@ -16,9 +16,10 @@ package server import ( "context" + "runtime" + "github.com/heroiclabs/nakama/v3/console" "go.uber.org/zap" - "runtime" ) type StatusHandler interface { diff --git a/server/tracker.go b/server/tracker.go index d1a7f5047..412773065 100644 --- a/server/tracker.go +++ b/server/tracker.go @@ -17,7 +17,6 @@ package server import ( "context" "fmt" - "google.golang.org/protobuf/types/known/wrapperspb" "sync" syncAtomic "sync/atomic" "time" @@ -29,6 +28,7 @@ import ( "go.uber.org/zap" "google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/proto" + "google.golang.org/protobuf/types/known/wrapperspb" ) const ( diff --git a/social/social.go b/social/social.go index 707a6b461..d4498e8ee 100644 --- a/social/social.go +++ b/social/social.go @@ -26,7 +26,6 @@ import ( "encoding/pem" "errors" "fmt" - "go.uber.org/zap" "io/ioutil" "math/big" "net/http" @@ -37,6 +36,7 @@ import ( "time" "github.com/dgrijalva/jwt-go" + "go.uber.org/zap" ) // Client is responsible for making calls to different providers -- GitLab