Skip to content

Commit ed7e5fb

Browse files
committed
Enable ineffassign linter
This also fixes all warnings about it.
1 parent 777dec0 commit ed7e5fb

5 files changed

Lines changed: 7 additions & 4 deletions

File tree

.golangci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ linters:
55
default: none
66
enable:
77
- govet
8+
- ineffassign
89

910
# See: https://golangci-lint.run/usage/formatters/
1011
formatters:

pgconn/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,7 @@ func configTLS(settings map[string]string, thisHost string, parseConfigOptions P
788788
// Attempt decryption with pass phrase
789789
// NOTE: only supports RSA (PKCS#1)
790790
if sslpassword != "" {
791-
decryptedKey, decryptedError = x509.DecryptPEMBlock(block, []byte(sslpassword))
791+
decryptedKey, decryptedError = x509.DecryptPEMBlock(block, []byte(sslpassword)) //nolint:ineffassign
792792
}
793793
// if sslpassword not provided or has decryption error when use it
794794
// try to find sslpassword with callback function

pgconn/ctxwatch/context_watcher_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ func TestContextWatcherStress(t *testing.T) {
116116

117117
for i := range cycleCount {
118118
ctx, cancel := context.WithCancel(context.Background())
119+
defer cancel() // satisfy linter; cancel is idempotent
119120
cw.Watch(ctx)
120121
if i%2 == 0 {
121122
cancel()

pgconn/pgconn_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2648,7 +2648,8 @@ func TestConnCloseWhileCancellableQueryInProgress(t *testing.T) {
26482648

26492649
pgConn.Exec(ctx, "select n from generate_series(1,10) n")
26502650

2651-
closeCtx, _ := context.WithCancel(ctx)
2651+
closeCtx, closeCancel := context.WithCancel(ctx)
2652+
defer closeCancel()
26522653
pgConn.Close(closeCtx)
26532654
select {
26542655
case <-pgConn.CleanupDone():
@@ -3909,7 +3910,7 @@ func TestSNISupport(t *testing.T) {
39093910

39103911
_, port, _ := strings.Cut(ln.Addr().String(), ":")
39113912
connStr := fmt.Sprintf("sslmode=require host=localhost port=%s %s", port, tt.sni_param)
3912-
_, err = pgconn.Connect(ctx, connStr)
3913+
_, _ = pgconn.Connect(ctx, connStr)
39133914

39143915
select {
39153916
case sniHost := <-serverSNINameChan:

pgtype/array.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ func arrayParseQuotedValue(buf *bytes.Buffer) (string, bool, error) {
299299
return "", false, err
300300
}
301301
case '"':
302-
r, _, err = buf.ReadRune()
302+
_, _, err = buf.ReadRune()
303303
if err != nil {
304304
return "", false, err
305305
}

0 commit comments

Comments
 (0)