Commit 7fada7ee authored by Andrei Mihu's avatar Andrei Mihu
Browse files

Improve social package struct field alignment.

parent 13af91f4
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import (
	"github.com/golang/protobuf/jsonpb"
	"github.com/heroiclabs/nakama-common/api"
	"github.com/heroiclabs/nakama-common/rtapi"
	"github.com/heroiclabs/nakama-common/runtime"
	"github.com/heroiclabs/nakama/v3/apigrpc"
	_ "github.com/jackc/pgx/stdlib"
	"go.uber.org/zap"
@@ -108,7 +109,7 @@ func (d *DummySession) SendBytes(payload []byte, reliable bool) error {
	return nil
}

func (d *DummySession) Close(reason string) {}
func (d *DummySession) Close(msg string, reason runtime.PresenceReason) {}

type loggerEnabler struct{}

@@ -167,7 +168,7 @@ func NewAPIServer(t *testing.T, runtime *Runtime) (*ApiServer, *Pipeline) {
	router := &DummyMessageRouter{}
	tracker := &LocalTracker{}
	pipeline := NewPipeline(logger, cfg, db, jsonpbMarshaler, jsonpbUnmarshaler, nil, nil, nil, nil, nil, tracker, router, runtime)
	apiServer := StartApiServer(logger, logger, db, jsonpbMarshaler, jsonpbUnmarshaler, cfg, nil, nil, nil, nil, nil, nil, nil, tracker, router, metrics, pipeline, runtime)
	apiServer := StartApiServer(logger, logger, db, jsonpbMarshaler, jsonpbUnmarshaler, cfg, nil, nil, nil, nil, nil, nil, nil, nil, tracker, router, metrics, pipeline, runtime)
	return apiServer, pipeline
}

+7 −7
Original line number Diff line number Diff line
@@ -70,7 +70,7 @@ func TestUpdateWalletSingleUser(t *testing.T) {
	}

	db := NewDB(t)
	nk := NewRuntimeGoNakamaModule(logger, db, nil, cfg, nil, nil, nil, nil, nil, nil, nil, nil, nil)
	nk := NewRuntimeGoNakamaModule(logger, db, nil, cfg, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil)

	userID, _, _, err := AuthenticateCustom(context.Background(), logger, db, uuid.Must(uuid.NewV4()).String(), uuid.Must(uuid.NewV4()).String(), true)
	if err != nil {
@@ -148,7 +148,7 @@ func TestUpdateWalletMultiUser(t *testing.T) {
	}

	db := NewDB(t)
	nk := NewRuntimeGoNakamaModule(logger, db, nil, cfg, nil, nil, nil, nil, nil, nil, nil, nil, nil)
	nk := NewRuntimeGoNakamaModule(logger, db, nil, cfg, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil)
	count := 5

	userIDs := make([]string, 0, count)
@@ -235,7 +235,7 @@ func TestUpdateWalletsMultiUser(t *testing.T) {
	}

	db := NewDB(t)
	nk := NewRuntimeGoNakamaModule(logger, db, nil, cfg, nil, nil, nil, nil, nil, nil, nil, nil, nil)
	nk := NewRuntimeGoNakamaModule(logger, db, nil, cfg, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil)
	count := 5

	userIDs := make([]string, 0, count)
@@ -327,7 +327,7 @@ func TestUpdateWalletsMultiUserSharedChangeset(t *testing.T) {
	}

	db := NewDB(t)
	nk := NewRuntimeGoNakamaModule(logger, db, nil, cfg, nil, nil, nil, nil, nil, nil, nil, nil, nil)
	nk := NewRuntimeGoNakamaModule(logger, db, nil, cfg, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil)
	count := 5

	userIDs := make([]string, 0, count)
@@ -423,7 +423,7 @@ func TestUpdateWalletsMultiUserSharedChangesetDeductions(t *testing.T) {
	}

	db := NewDB(t)
	nk := NewRuntimeGoNakamaModule(logger, db, nil, cfg, nil, nil, nil, nil, nil, nil, nil, nil, nil)
	nk := NewRuntimeGoNakamaModule(logger, db, nil, cfg, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil)
	count := 5

	userIDs := make([]string, 0, count)
@@ -478,7 +478,7 @@ func TestUpdateWalletsMultiUserSharedChangesetDeductions(t *testing.T) {

func TestUpdateWalletsSingleUser(t *testing.T) {
	db := NewDB(t)
	nk := NewRuntimeGoNakamaModule(logger, db, nil, cfg, nil, nil, nil, nil, nil, nil, nil, nil, nil)
	nk := NewRuntimeGoNakamaModule(logger, db, nil, cfg, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil)

	userID, _, _, err := AuthenticateCustom(context.Background(), logger, db, uuid.Must(uuid.NewV4()).String(), uuid.Must(uuid.NewV4()).String(), true)
	if err != nil {
@@ -525,7 +525,7 @@ func TestUpdateWalletsSingleUser(t *testing.T) {

func TestUpdateWalletRepeatedSingleUser(t *testing.T) {
	db := NewDB(t)
	nk := NewRuntimeGoNakamaModule(logger, db, nil, cfg, nil, nil, nil, nil, nil, nil, nil, nil, nil)
	nk := NewRuntimeGoNakamaModule(logger, db, nil, cfg, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil)

	userID, _, _, err := AuthenticateCustom(context.Background(), logger, db, uuid.Must(uuid.NewV4()).String(), uuid.Must(uuid.NewV4()).String(), true)
	if err != nil {
+2 −2
Original line number Diff line number Diff line
@@ -77,7 +77,7 @@ func runtimeWithModules(t *testing.T, modules map[string]string) (*Runtime, *Run
	cfg := NewConfig(logger)
	cfg.Runtime.Path = dir

	return NewRuntime(logger, logger, NewDB(t), jsonpbMarshaler, jsonpbUnmarshaler, cfg, nil, nil, nil, nil, nil, nil, nil, metrics, nil, &DummyMessageRouter{})
	return NewRuntime(logger, logger, NewDB(t), jsonpbMarshaler, jsonpbUnmarshaler, cfg, nil, nil, nil, nil, nil, nil, nil, nil, metrics, nil, &DummyMessageRouter{})
}

func TestRuntimeSampleScript(t *testing.T) {
@@ -355,7 +355,7 @@ nakama.register_rpc(test.printWorld, "helloworld")`,

	db := NewDB(t)
	pipeline := NewPipeline(logger, cfg, db, jsonpbMarshaler, jsonpbUnmarshaler, nil, nil, nil, nil, nil, nil, nil, runtime)
	apiServer := StartApiServer(logger, logger, db, jsonpbMarshaler, jsonpbUnmarshaler, cfg, nil, nil, nil, nil, nil, nil, nil, nil, nil, metrics, pipeline, runtime)
	apiServer := StartApiServer(logger, logger, db, jsonpbMarshaler, jsonpbUnmarshaler, cfg, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, metrics, pipeline, runtime)
	defer apiServer.Stop()

	payload := "\"Hello World\""
+5 −5
Original line number Diff line number Diff line
@@ -66,14 +66,14 @@ type JwksCerts struct {

// JWK certificate data for an Apple Sign In verification key.
type JwksCert struct {
	key *rsa.PublicKey

	Kty string `json:"kty"`
	Kid string `json:"kid"`
	Use string `json:"use"`
	Alg string `json:"alg"`
	N   string `json:"n"`
	E   string `json:"e"`

	key *rsa.PublicKey
}

// AppleProfile is an abbreviated version of a user authenticated through Apple Sign In.
@@ -103,8 +103,8 @@ type facebookPaging struct {
}

type facebookFriends struct {
	Data   []FacebookProfile `json:"data"`
	Paging facebookPaging    `json:"paging"`
	Data   []FacebookProfile `json:"data"`
}

// GoogleProfile is an abbreviated version of a Google profile extracted from in a verified ID token.
@@ -141,8 +141,8 @@ type steamFriendsWrapper struct {

// SteamError contains a possible error response from the Steam Web API.
type SteamError struct {
	ErrorCode int    `json:"errorcode"`
	ErrorDesc string `json:"errordesc"`
	ErrorCode int    `json:"errorcode"`
}

// Unwrapping the SteamProfile
@@ -276,9 +276,9 @@ func (c *Client) ExtractFacebookInstantGameID(signedPlayerInfo string, appSecret

	var payload struct {
		Algorithm      string `json:"algorithm"`
		IssuedAt       int    `json:"issued_at"`
		PlayerID       string `json:"player_id"`
		RequestPayload string `json:"request_payload"` // discarded
		IssuedAt       int    `json:"issued_at"`
	}
	err = json.Unmarshal(payloadRaw, &payload)
	if err != nil {