Skip to content

Add execinquery linter #2677

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Mar 29, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
review: rename files and fix tests
  • Loading branch information
ldez committed Mar 29, 2022
commit 23575d99881bba23278e6c288bc22754a7b36f97
File renamed without changes.
34 changes: 34 additions & 0 deletions test/testdata/execinquery.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//args: -Eexecinquery
package testdata

import (
"database/sql"

"golang.org/x/net/context"
)

func execinquery() {
db, _ := sql.Open("mysql", "test:test@tcp(test:3306)/test")

test := "a"

_, err := db.Query("Update * FROM hoge where id = ?", test) // ERROR "Query not `SELECT` query"
if err != nil {
return
}

db.QueryRow("Update * FROM hoge where id = ?", test) // ERROR "Query not `SELECT` query"
if err != nil {
return
}

ctx := context.Background()

_, err = db.QueryContext(ctx, "Update * FROM hoge where id = ?", test) // ERROR "Query not `SELECT` query"
if err != nil {
return
}

db.QueryRowContext(ctx, "Update * FROM hoge where id = ?", test) // ERROR "Query not `SELECT` query"

}
15 changes: 0 additions & 15 deletions test/testdata/querycheck.go

This file was deleted.