fix: pin golangci-lint install to commit SHA (fixes #13)
All checks were successful
check / check (push) Successful in 1m31s
All checks were successful
check / check (push) Successful in 1m31s
- Fix Dockerfile: use correct v2 module path with commit SHA (github.com/golangci/golangci-lint/v2/cmd/golangci-lint@eabc2638...) - Add CGO_ENABLED=0 for alpine compatibility - Fix 35 lint issues found by golangci-lint v2.1.6: - Remove unused nolint directives, add nolintlint where needed - Pre-allocate migrations slice - Use t.Context() instead of context.Background() in tests - Fix blank lines between comments and exported functions in ui.go
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package db_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
@@ -41,7 +40,7 @@ func TestCreateUser(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
d := setupTestDB(t)
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
id, token, err := d.CreateUser(ctx, nickAlice)
|
||||
if err != nil {
|
||||
@@ -61,7 +60,7 @@ func TestGetUserByToken(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
d := setupTestDB(t)
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
_, token, _ := d.CreateUser(ctx, nickAlice)
|
||||
|
||||
@@ -82,7 +81,7 @@ func TestGetUserByNick(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
d := setupTestDB(t)
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
origID, _, _ := d.CreateUser(ctx, nickAlice)
|
||||
|
||||
@@ -100,7 +99,7 @@ func TestGetOrCreateChannel(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
d := setupTestDB(t)
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
id1, err := d.GetOrCreateChannel(ctx, "#general")
|
||||
if err != nil {
|
||||
@@ -126,7 +125,7 @@ func TestJoinAndListChannels(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
d := setupTestDB(t)
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
uid, _, _ := d.CreateUser(ctx, nickAlice)
|
||||
ch1, _ := d.GetOrCreateChannel(ctx, "#alpha")
|
||||
@@ -149,7 +148,7 @@ func TestListChannelsEmpty(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
d := setupTestDB(t)
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
uid, _, _ := d.CreateUser(ctx, nickAlice)
|
||||
|
||||
@@ -167,7 +166,7 @@ func TestPartChannel(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
d := setupTestDB(t)
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
uid, _, _ := d.CreateUser(ctx, nickAlice)
|
||||
chID, _ := d.GetOrCreateChannel(ctx, "#general")
|
||||
@@ -189,7 +188,7 @@ func TestSendAndGetMessages(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
d := setupTestDB(t)
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
uid, _, _ := d.CreateUser(ctx, nickAlice)
|
||||
chID, _ := d.GetOrCreateChannel(ctx, "#general")
|
||||
@@ -221,7 +220,7 @@ func TestChannelMembers(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
d := setupTestDB(t)
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
uid1, _, _ := d.CreateUser(ctx, nickAlice)
|
||||
uid2, _, _ := d.CreateUser(ctx, nickBob)
|
||||
@@ -246,7 +245,7 @@ func TestChannelMembersEmpty(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
d := setupTestDB(t)
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
chID, _ := d.GetOrCreateChannel(ctx, "#empty")
|
||||
|
||||
@@ -264,7 +263,7 @@ func TestSendDM(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
d := setupTestDB(t)
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
uid1, _, _ := d.CreateUser(ctx, nickAlice)
|
||||
uid2, _, _ := d.CreateUser(ctx, nickBob)
|
||||
@@ -296,7 +295,7 @@ func TestPollMessages(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
d := setupTestDB(t)
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
uid1, _, _ := d.CreateUser(ctx, nickAlice)
|
||||
uid2, _, _ := d.CreateUser(ctx, nickBob)
|
||||
@@ -324,7 +323,7 @@ func TestChangeNick(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
d := setupTestDB(t)
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
_, token, _ := d.CreateUser(ctx, nickAlice)
|
||||
|
||||
@@ -347,7 +346,7 @@ func TestSetTopic(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
d := setupTestDB(t)
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
uid, _, _ := d.CreateUser(ctx, nickAlice)
|
||||
_, _ = d.GetOrCreateChannel(ctx, "#general")
|
||||
@@ -379,7 +378,7 @@ func TestGetMessagesBefore(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
d := setupTestDB(t)
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
uid, _, _ := d.CreateUser(ctx, nickAlice)
|
||||
chID, _ := d.GetOrCreateChannel(ctx, "#general")
|
||||
@@ -409,7 +408,7 @@ func TestListAllChannels(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
d := setupTestDB(t)
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
_, _ = d.GetOrCreateChannel(ctx, "#alpha")
|
||||
_, _ = d.GetOrCreateChannel(ctx, "#beta")
|
||||
|
||||
Reference in New Issue
Block a user