Skip to content

Commit 0e0d496

Browse files
MirrexOneclaude
andcommitted
Add missing golangcitest directive and integration test
- Added //golangcitest:args -Egounqvet directive to testdata - Created gounqvet_test.go with TestFromTestdata function - Formatted testdata file with gofmt - Verified gounqvet integration works correctly 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent c62d2b5 commit 0e0d496

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package gounqvet
2+
3+
import (
4+
"testing"
5+
6+
"github.com/golangci/golangci-lint/v2/test/testshared/integration"
7+
)
8+
9+
func TestFromTestdata(t *testing.T) {
10+
integration.RunTestdata(t)
11+
}

pkg/golinters/gounqvet/testdata/gounqvet.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//golangcitest:args -Egounqvet
12
package testdata
23

34
import (
@@ -8,21 +9,21 @@ import (
89

910
func badQueries() {
1011
query := "SELECT * FROM users" // want "avoid SELECT \\* - explicitly specify needed columns for better performance, maintainability and stability"
11-
12+
1213
var db *sql.DB
1314
rows, _ := db.Query("SELECT * FROM orders WHERE status = ?", "active") // want "avoid SELECT \\* - explicitly specify needed columns for better performance, maintainability and stability"
1415
_ = rows
15-
16+
1617
// This should not trigger because it's a COUNT function
1718
count := "SELECT COUNT(*) FROM users"
1819
_ = count
19-
20+
2021
// Good queries (should not trigger)
2122
goodQuery := "SELECT id, name, email FROM users"
2223
_ = goodQuery
23-
24+
2425
fmt.Println(query)
25-
26+
2627
// Use strconv to satisfy std lib import requirement
2728
_ = strconv.Itoa(42)
2829
}

0 commit comments

Comments
 (0)