Skip to content

Commit 2152c4e

Browse files
authored
Fix .golangci.yml (#22868)
When we updated the .golangci.yml for 1.20 we should have used a string as 1.20 is not a valid number. In doing so we need to restore the nolint markings within the pq driver. Signed-off-by: Andrew Thornton <art27@cantab.net>
1 parent d4a9b35 commit 2152c4e

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

.golangci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ linters:
2828
fast: false
2929

3030
run:
31-
go: 1.20
31+
go: "1.20"
3232
timeout: 10m
3333
skip-dirs:
3434
- node_modules

models/db/sql_postgres_with_schema.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ func (d *postgresSchemaDriver) Open(name string) (driver.Conn, error) {
3737
}
3838
schemaValue, _ := driver.String.ConvertValue(setting.Database.Schema)
3939

40-
if execer, ok := conn.(driver.Execer); ok {
40+
// golangci lint is incorrect here - there is no benefit to using driver.ExecerContext here
41+
// and in any case pq does not implement it
42+
if execer, ok := conn.(driver.Execer); ok { //nolint
4143
_, err := execer.Exec(`SELECT set_config(
4244
'search_path',
4345
$1 || ',' || current_setting('search_path'),
@@ -61,7 +63,8 @@ func (d *postgresSchemaDriver) Open(name string) (driver.Conn, error) {
6163

6264
// driver.String.ConvertValue will never return err for string
6365

64-
_, err = stmt.Exec([]driver.Value{schemaValue})
66+
// golangci lint is incorrect here - there is no benefit to using stmt.ExecWithContext here
67+
_, err = stmt.Exec([]driver.Value{schemaValue}) //nolint
6568
if err != nil {
6669
_ = conn.Close()
6770
return nil, err

0 commit comments

Comments
 (0)