Skip to content

Commit

Permalink
Fix linting issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
zyro committed Nov 24, 2024
1 parent 8d0f206 commit e7a7a7d
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 23 deletions.
60 changes: 44 additions & 16 deletions server/core_friend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,50 @@ func TestServer_ListFriendsOfFriends(t *testing.T) {
t.Fatal(err)
}

addFriend(ctx, logger, tx, uid, uidA1.String())
addFriend(ctx, logger, tx, uidA1, uid.String())
addFriend(ctx, logger, tx, uidA1, uidA2.String())
addFriend(ctx, logger, tx, uidA2, uidA1.String())
addFriend(ctx, logger, tx, uidA1, uidA3.String())
addFriend(ctx, logger, tx, uidA3, uidA1.String())

addFriend(ctx, logger, tx, uid, uidB1.String())
addFriend(ctx, logger, tx, uidB1, uid.String())
addFriend(ctx, logger, tx, uidB1, uidB2.String())
addFriend(ctx, logger, tx, uidB2, uidB1.String())
addFriend(ctx, logger, tx, uidB1, uidB3.String())
addFriend(ctx, logger, tx, uidB3, uidB1.String())

addFriend(ctx, logger, tx, uid, uidB3.String())
addFriend(ctx, logger, tx, uidB3, uid.String())
if _, err := addFriend(ctx, logger, tx, uid, uidA1.String()); err != nil {
t.Fatal(err)
}
if _, err := addFriend(ctx, logger, tx, uidA1, uid.String()); err != nil {
t.Fatal(err)
}
if _, err := addFriend(ctx, logger, tx, uidA1, uidA2.String()); err != nil {
t.Fatal(err)
}
if _, err := addFriend(ctx, logger, tx, uidA2, uidA1.String()); err != nil {
t.Fatal(err)
}
if _, err := addFriend(ctx, logger, tx, uidA1, uidA3.String()); err != nil {
t.Fatal(err)
}
if _, err := addFriend(ctx, logger, tx, uidA3, uidA1.String()); err != nil {
t.Fatal(err)
}

if _, err := addFriend(ctx, logger, tx, uid, uidB1.String()); err != nil {
t.Fatal(err)
}
if _, err := addFriend(ctx, logger, tx, uidB1, uid.String()); err != nil {
t.Fatal(err)
}
if _, err := addFriend(ctx, logger, tx, uidB1, uidB2.String()); err != nil {
t.Fatal(err)
}
if _, err := addFriend(ctx, logger, tx, uidB2, uidB1.String()); err != nil {
t.Fatal(err)
}
if _, err := addFriend(ctx, logger, tx, uidB1, uidB3.String()); err != nil {
t.Fatal(err)
}
if _, err := addFriend(ctx, logger, tx, uidB3, uidB1.String()); err != nil {
t.Fatal(err)
}

if _, err := addFriend(ctx, logger, tx, uid, uidB3.String()); err != nil {
t.Fatal(err)
}
if _, err := addFriend(ctx, logger, tx, uidB3, uid.String()); err != nil {
t.Fatal(err)
}

if err = tx.Commit(); err != nil {
t.Fatal(err)
Expand Down
8 changes: 4 additions & 4 deletions server/matchmaker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ package server
import (
"context"
"errors"
"github.com/heroiclabs/nakama-common/api"
"math"
"os"
"testing"
"time"

"github.com/blugelabs/bluge"
"github.com/gofrs/uuid/v5"
"github.com/heroiclabs/nakama-common/api"
"github.com/heroiclabs/nakama-common/rtapi"
"github.com/heroiclabs/nakama-common/runtime"
"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -187,16 +187,16 @@ func TestMatchmakerPropertyRegexSubmatch(t *testing.T) {
SessionIDs: map[string]struct{}{"sid1": {}},
})
if err != nil {
t.Fatalf(err.Error())
t.Fatal(err)
}

if err := matchMaker.indexWriter.Update(bluge.Identifier("ticket1"), matchmakerIndexDoc1); err != nil {
t.Fatalf(err.Error())
t.Fatal(err)
}

reader, err := matchMaker.indexWriter.Reader()
if err != nil {
t.Fatalf(err.Error())
t.Fatal(err)
}
defer reader.Close()

Expand Down
2 changes: 1 addition & 1 deletion server/runtime_lua_loadlib.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func OpenPackage(moduleCache *RuntimeLuaModuleCache) func(L *lua.LState) int {
}
fn, err := L.Load(bytes.NewReader(module.Content), module.Path)
if err != nil {
L.RaiseError(err.Error())
L.RaiseError("error loading module: %v", err.Error())
}
L.Push(fn)
return 1
Expand Down
4 changes: 2 additions & 2 deletions server/runtime_lua_nakama.go
Original file line number Diff line number Diff line change
Expand Up @@ -2607,15 +2607,15 @@ func (n *RuntimeLuaNakamaModule) accountsGetId(l *lua.LState) int {

userTable, err := userToLuaTable(l, account.User)
if err != nil {
l.RaiseError(fmt.Sprintf("failed to convert user data to lua table: %s", err.Error()))
l.RaiseError("failed to convert user data to lua table: %s", err.Error())
return 0
}
accountTable.RawSetString("user", userTable)

walletMap := make(map[string]int64)
err = json.Unmarshal([]byte(account.Wallet), &walletMap)
if err != nil {
l.RaiseError(fmt.Sprintf("failed to convert wallet to json: %s", err.Error()))
l.RaiseError("failed to convert wallet to json: %s", err.Error())
return 0
}
walletTable := RuntimeLuaConvertMapInt64(l, walletMap)
Expand Down

0 comments on commit e7a7a7d

Please sign in to comment.