Skip to content

Commit

Permalink
bump github.com/lufeee/execinquery from v1.0.0 to v1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez committed May 12, 2022
1 parent 59971a1 commit 01c5b46
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion go.mod
Expand Up @@ -54,7 +54,7 @@ require (
github.com/ldez/gomoddirectives v0.2.3
github.com/ldez/tagliatelle v0.3.1
github.com/leonklingele/grouper v1.1.0
github.com/lufeee/execinquery v1.0.0
github.com/lufeee/execinquery v1.2.0
github.com/maratori/testpackage v1.0.1
github.com/matoous/godox v0.0.0-20210227103229-6504466cf951 // v1.0
github.com/mattn/go-colorable v0.1.12
Expand Down
4 changes: 2 additions & 2 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/golinters/execinquery.go
Expand Up @@ -15,5 +15,5 @@ func NewExecInQuery() *goanalysis.Linter {
a.Doc,
[]*analysis.Analyzer{a},
nil,
).WithLoadMode(goanalysis.LoadModeSyntax)
).WithLoadMode(goanalysis.LoadModeTypesInfo)
}
1 change: 1 addition & 0 deletions pkg/lint/lintersdb/manager.go
Expand Up @@ -271,6 +271,7 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
linter.NewConfig(golinters.NewExecInQuery()).
WithSince("v1.46.0").
WithPresets(linter.PresetSQL).
WithLoadForGoAnalysis().
WithURL("https://github.com/lufeee/execinquery"),

linter.NewConfig(golinters.NewExhaustive(exhaustiveCfg)).
Expand Down
8 changes: 4 additions & 4 deletions test/testdata/execinquery.go
Expand Up @@ -9,22 +9,22 @@ import (
func execInQuery(db *sql.DB) {
test := "a"

_, err := db.Query("Update * FROM hoge where id = ?", test) // ERROR "It's better to use Execute method instead of Query method to execute `UPDATE` query"
_, err := db.Query("Update * FROM hoge where id = ?", test) // ERROR "Use ExecContext instead of Query to execute `UPDATE` query"
if err != nil {
return
}

db.QueryRow("Update * FROM hoge where id = ?", test) // ERROR "It's better to use Execute method instead of QueryRow method to execute `UPDATE` query"
db.QueryRow("Update * FROM hoge where id = ?", test) // ERROR "Use ExecContext instead of QueryRow to execute `UPDATE` query"
if err != nil {
return
}

ctx := context.Background()

_, err = db.QueryContext(ctx, "Update * FROM hoge where id = ?", test) // ERROR "It's better to use Execute method instead of QueryContext method to execute `UPDATE` query "
_, err = db.QueryContext(ctx, "Update * FROM hoge where id = ?", test) // ERROR "Use ExecContext instead of QueryContext to execute `UPDATE` query"
if err != nil {
return
}

db.QueryRowContext(ctx, "Update * FROM hoge where id = ?", test) // ERROR "It's better to use Execute method instead of QueryRowContext method to execute `UPDATE` query"
db.QueryRowContext(ctx, "Update * FROM hoge where id = ?", test) // ERROR "Use ExecContext instead of QueryRowContext to execute `UPDATE` query"
}

0 comments on commit 01c5b46

Please sign in to comment.