mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	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>
This commit is contained in:
		@@ -28,7 +28,7 @@ linters:
 | 
				
			|||||||
  fast: false
 | 
					  fast: false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
run:
 | 
					run:
 | 
				
			||||||
  go: 1.20
 | 
					  go: "1.20"
 | 
				
			||||||
  timeout: 10m
 | 
					  timeout: 10m
 | 
				
			||||||
  skip-dirs:
 | 
					  skip-dirs:
 | 
				
			||||||
    - node_modules
 | 
					    - node_modules
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -37,7 +37,9 @@ func (d *postgresSchemaDriver) Open(name string) (driver.Conn, error) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	schemaValue, _ := driver.String.ConvertValue(setting.Database.Schema)
 | 
						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(
 | 
							_, err := execer.Exec(`SELECT set_config(
 | 
				
			||||||
			'search_path',
 | 
								'search_path',
 | 
				
			||||||
			$1 || ',' || current_setting('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
 | 
						// 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 {
 | 
						if err != nil {
 | 
				
			||||||
		_ = conn.Close()
 | 
							_ = conn.Close()
 | 
				
			||||||
		return nil, err
 | 
							return nil, err
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user