10000 chore: upgrade golangci-lint to v1.60.0 · coder/coder@a85fd8b · GitHub
[go: up one dir, main page]

Skip to content

Commit a85fd8b

Browse files
committed
chore: upgrade golangci-lint to v1.60.0
1 parent c96d439 commit a85fd8b

File tree

17 files changed

+27
-82
lines changed

17 files changed

+27
-82
lines changed

.github/workflows/coder.yaml

Lines changed: 1 addition & 1 deletion
EDBE
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
- name: golangci-lint
4343
uses: golangci/golangci-lint-action@v3.1.0
4444
with:
45-
version: v1.45.2
45+
version: v1.46.0
4646

4747
style-lint-typescript:
4848
name: "style/lint/typescript"

.golangci.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ linters-settings:
105105
failOn: all
106106
rules: rules.go
107107

108+
staticcheck:
109+
# https://staticcheck.io/docs/options#checks
110+
checks: ["all", "-SA1019"]
111+
108112
goimports:
109113
local-prefixes: coder.com,cdr.dev,go.coder.com,github.com/cdr,github.com/coder
110114

@@ -235,7 +239,7 @@ linters:
235239
# without testing any exported functions. This is enabled to promote
236240
# decomposing a package before testing it's internals. A function caller
237241
# should be able to test most of the functionality from exported functions.
238-
#
242+
#
239243
# There are edge-cases to this rule, but they should be carefully considered
240244
# to avoid structural inconsistency.
241245
- testpackage

cli/gitssh_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func TestGitSSH(t *testing.T) {
6060

6161
// start workspace agent
6262
cmd, root := clitest.New(t, "agent", "--agent-token", agentToken, "--agent-url", client.URL.String())
63-
agentClient := &*client
63+
agentClient := client
6464
clitest.SetupConfig(t, agentClient, root)
6565
ctx, cancelFunc := context.WithCancel(context.Background())
6666
defer cancelFunc()

cli/ssh.go

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@ package cli
33
import (
44
"context"
55
"io"
6-
"net"
76
"os"
87
"strings"
9-
"time"
108

119
"github.com/google/uuid"
1210
"github.com/mattn/go-isatty"
@@ -181,32 +179,3 @@ func ssh() *cobra.Command {
181179

182180
return cmd
183181
}
184-
185-
type stdioConn struct {
186-
io.Reader
187-
io.Writer
188-
}
189-
190-
func (*stdioConn) Close() (err error) {
191-
return nil
192-
}
193-
194-
func (*stdioConn) LocalAddr() net.Addr {
195-
return nil
196-
}
197-
198-
func (*stdioConn) RemoteAddr() net.Addr {
199-
return nil
200-
}
201-
202-
func (*stdioConn) SetDeadline(_ time.Time) error {
203-
return nil
204-
}
205-
206-
func (*stdioConn) SetReadDeadline(_ time.Time) error {
207-
return nil
208-
}
209-
210-
func (*stdioConn) SetWriteDeadline(_ time.Time) error {
211-
return nil
212-
}

coderd/audit/backends/postgres.go

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,7 @@ func (b *postgresBackend) Decision() audit.FilterDecision {
3131
}
3232

3333
func (b *postgresBackend) Export(ctx context.Context, alog database.AuditLog) error {
34-
_, err := b.db.InsertAuditLog(ctx, database.InsertAuditLogParams{
35-
ID: alog.ID,
36-
Time: alog.Time,
37-
UserID: alog.UserID,
38-
OrganizationID: alog.OrganizationID,
39-
Ip: alog.Ip,
40-
UserAgent: alog.UserAgent,
41-
ResourceType: alog.ResourceType,
42-
ResourceID: alog.ResourceID,
43-
ResourceTarget: alog.ResourceTarget,
44-
Action: alog.Action,
45-
Diff: alog.Diff,
46-
StatusCode: alog.StatusCode,
47-
})
34+
_, err := b.db.InsertAuditLog(ctx, database.InsertAuditLogParams(alog))
4835
if err != nil {
4936
return xerrors.Errorf("insert audit log: %w", err)
5037
}

coderd/coderdtest/coderdtest.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ func New(t *testing.T, options *Options) *codersdk.Client {
7777
db := databasefake.New()
7878
pubsub := database.NewPubsubInMemory()
7979
if os.Getenv("DB") != "" {
80-
connectionURL, close, err := postgres.Open()
80+
connectionURL, closePg, err := postgres.Open()
8181
require.NoError(t, err)
82-
t.Cleanup(close)
82+
t.Cleanup(closePg)
8383
sqlDB, err := sql.Open("postgres", connectionURL)
8484
require.NoError(t, err)
8585
t.Cleanup(func() {

coderd/database/databasefake/databasefake.go

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1733,20 +1733,7 @@ func (q *fakeQuerier) InsertAuditLog(_ context.Context, arg database.InsertAudit
17331733
q.mutex.Lock()
17341734
defer q.mutex.Unlock()
17351735

1736-
alog := database.AuditLog{
1737-
ID: arg.ID,
1738-
Time: arg.Time,
1739-
UserID: arg.UserID,
1740-
OrganizationID: arg.OrganizationID,
1741-
Ip: arg.Ip,
1742-
UserAgent: arg.UserAgent,
1743-
ResourceType: arg.ResourceType,
1744-
ResourceID: arg.ResourceID,
1745-
ResourceTarget: arg.ResourceTarget,
1746-
Action: arg.Action,
1747-
Diff: arg.Diff,
1748-
StatusCode: arg.StatusCode,
1749-
}
1736+
alog := database.AuditLog(arg)
17501737

17511738
q.auditLogs = append(q.auditLogs, alog)
17521739
slices.SortFunc(q.auditLogs, func(a, b database.AuditLog) bool {

coderd/database/postgres/postgres_test.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@ import (
66
"database/sql"
77
"testing"
88

9+
_ "github.com/lib/pq"
910
"github.com/stretchr/testify/require"
1011
"go.uber.org/goleak"
1112

1213
"github.com/coder/coder/coderd/database/postgres"
13-
14-
_ "github.com/lib/pq"
1514
)
1615

1716
func TestMain(m *testing.M) {
@@ -26,9 +25,9 @@ func TestPostgres(t *testing.T) {
2625
return
2726
}
2827

29-
connect, close, err := postgres.Open()
28+
connect, closePg, err := postgres.Open()
3029
require.NoError(t, err)
31-
defer close()
30+
defer closePg()
3231
db, err := sql.Open("postgres", connect)
3332
require.NoError(t, err)
3433
err = db.Ping()

coderd/database/pubsub_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ func TestPubsub(t *testing.T) {
2727
ctx, cancelFunc := context.WithCancel(context.Background())
2828
defer cancelFunc()
2929

30-
connectionURL, close, err := postgres.Open()
30+
connectionURL, closePg, err := postgres.Open()
3131
require.NoError(t, err)
32-
defer close()
32+
defer closePg()
3333
db, err := sql.Open("postgres", connectionURL)
3434
require.NoError(t, err)
3535
defer db.Close()
@@ -56,9 +56,9 @@ func TestPubsub(t *testing.T) {
5656
t.Parallel()
5757
ctx, cancelFunc := context.WithCancel(context.Background())
5858
defer cancelFunc()
59-
connectionURL, close, err := postgres.Open()
59+
connectionURL, closePg, err := postgres.Open()
6060
require.NoError(t, err)
61-
defer close()
61+
defer closePg()
6262
db, err := sql.Open("postgres", connectionURL)
6363
require.NoError(t, err)
6464
defer db.Close()

coderd/httpmw/oauth2.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func ExtractOAuth2(config OAuth2Config) func(http.Handler) http.Handler {
4848
return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
4949
if config == nil {
5050
httpapi.Write(rw, http.StatusPreconditionRequired, httpapi.Response{
51-
Message: fmt.Sprintf("The oauth2 method requested is not configured!"),
51+
Message: "The oauth2 method requested is not configured!",
5252
})
5353
return
5454
}

0 commit comments

Comments
 (0)
0