aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2023-02-11 21:44:53 +0000
committerGitHub <noreply@github.com>2023-02-11 21:44:53 +0000
commit2152c4e98f3ea2b17dc8cdd549612b5abed6cc9f (patch)
treeef068576bb5855df67e9b981bdd3fcf903da5199
parentd4a9b35c4be7cd28f8a2f7a3f1ad7b784eb71f5e (diff)
downloadgitea-2152c4e98f3ea2b17dc8cdd549612b5abed6cc9f.tar.gz
gitea-2152c4e98f3ea2b17dc8cdd549612b5abed6cc9f.zip
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>
-rw-r--r--.golangci.yml2
-rw-r--r--models/db/sql_postgres_with_schema.go7
2 files changed, 6 insertions, 3 deletions
diff --git a/.golangci.yml b/.golangci.yml
index aa04e0a8ef..263149f773 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -28,7 +28,7 @@ linters:
fast: false
run:
- go: 1.20
+ go: "1.20"
timeout: 10m
skip-dirs:
- node_modules
diff --git a/models/db/sql_postgres_with_schema.go b/models/db/sql_postgres_with_schema.go
index c2694b37bb..ec63447f6f 100644
--- a/models/db/sql_postgres_with_schema.go
+++ b/models/db/sql_postgres_with_schema.go
@@ -37,7 +37,9 @@ func (d *postgresSchemaDriver) Open(name string) (driver.Conn, error) {
}
schemaValue, _ := driver.String.ConvertValue(setting.Database.Schema)
- if execer, ok := conn.(driver.Execer); ok {
+ // golangci lint is incorrect here - there is no benefit to using driver.ExecerContext here
+ // and in any case pq does not implement it
+ if execer, ok := conn.(driver.Execer); ok { //nolint
_, err := execer.Exec(`SELECT set_config(
'search_path',
$1 || ',' || current_setting('search_path'),
@@ -61,7 +63,8 @@ func (d *postgresSchemaDriver) Open(name string) (driver.Conn, error) {
// driver.String.ConvertValue will never return err for string
- _, err = stmt.Exec([]driver.Value{schemaValue})
+ // golangci lint is incorrect here - there is no benefit to using stmt.ExecWithContext here
+ _, err = stmt.Exec([]driver.Value{schemaValue}) //nolint
if err != nil {
_ = conn.Close()
return nil, err