Skip to content

Commit 387c1bd

Browse files
committed
Remove unused function
1 parent fac054a commit 387c1bd

File tree

2 files changed

+9
-30
lines changed

2 files changed

+9
-30
lines changed

coderd/database/databasefake/generator.go

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,13 @@ import (
88
"testing"
99
"time"
1010

11-
"github.com/coder/coder/cryptorand"
12-
13-
"github.com/tabbed/pqtype"
14-
15-
"github.com/coder/coder/coderd/database"
1611
"github.com/google/uuid"
1712
"github.com/moby/moby/pkg/namesgenerator"
1813
"github.com/stretchr/testify/require"
14+
"github.com/tabbed/pqtype"
15+
16+
"github.com/coder/coder/coderd/database"
17+
"github.com/coder/coder/cryptorand"
1918
)
2019

2120
const primaryOrgName = "primary-org"
@@ -312,19 +311,19 @@ func (g *Generator) Populate(ctx context.Context, seed map[string]interface{}) m
312311
return seed
313312
}
314313

315-
func (tc *Generator) Lookup(name string) uuid.UUID {
314+
func (g *Generator) Lookup(name string) uuid.UUID {
316315
if name == "" {
317316
// No name means the caller doesn't care about the ID.
318317
return uuid.New()
319318
}
320-
if tc.names == nil {
321-
tc.names = make(map[string]uuid.UUID)
319+
if g.names == nil {
320+
g.names = make(map[string]uuid.UUID)
322321
}
323-
if id, ok := tc.names[name]; ok {
322+
if id, ok := g.names[name]; ok {
324323
return id
325324
}
326325
id := uuid.New()
327-
tc.names[name] = id
326+
g.names[name] = id
328327
return id
329328
}
330329

coderd/httpmw/ratelimit_test.go

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package httpmw_test
22

33
import (
44
"context"
5-
"crypto/sha256"
65
"fmt"
76
"math/rand"
87
"net"
@@ -12,7 +11,6 @@ import (
1211
"time"
1312

1413
"github.com/go-chi/chi/v5"
15-
"github.com/google/uuid"
1614
"github.com/stretchr/testify/require"
1715

1816
"github.com/coder/coder/coderd/database"
@@ -23,24 +21,6 @@ import (
2321
"github.com/coder/coder/testutil"
2422
)
2523

26-
func insertAPIKey(ctx context.Context, t *testing.T, db database.Store, userID uuid.UUID) string {
27-
id, secret := randomAPIKeyParts()
28-
hashed := sha256.Sum256([]byte(secret))
29-
30-
_, err := db.InsertAPIKey(ctx, database.InsertAPIKeyParams{
31-
ID: id,
32-
HashedSecret: hashed[:],
33-
LastUsed: database.Now().AddDate(0, 0, -1),
34-
ExpiresAt: database.Now().AddDate(0, 0, 1),
35-
UserID: userID,
36-
LoginType: database.LoginTypePassword,
37-
Scope: database.APIKeyScopeAll,
38-
})
39-
require.NoError(t, err)
40-
41-
return fmt.Sprintf("%s-%s", id, secret)
42-
}
43-
4424
func randRemoteAddr() string {
4525
var b [4]byte
4626
// nolint:gosec

0 commit comments

Comments
 (0)