Skip to content
This repository was archived by the owner on Mar 7, 2024. It is now read-only.

Repository files navigation

execinquery - a simple query string checker in Query function

Go MatrixGo lintMIT License

About

execinquery is a linter about query string checker in Query function which reads your Go src files and warnings it finds.

Installation

go install github.com/lufeee/execinquery/cmd/execinquery

Usage

package main
import (
"database/sql""log"
)
funcmain() {
db, err:=sql.Open("mysql", "test:test@tcp(test:3306)/test")
iferr!=nil {
log.Fatal("Database Connect Error: ", err)
}
deferdb.Close()
test:="a"_, err=db.Query("Update * FROM hoge where id = ?", test)
iferr!=nil {
log.Fatal("Query Error: ", err)
}
}
go vet -vettool=$(which execinquery) ./...
# command-line-arguments./a.go:16:11: Use Exec instead of Query to execute `UPDATE` query

CI

CircleCI

- run:
name: install execinquerycommand: go install github.com/lufeee/execinquery
- run:
name: run execinquerycommand: go vet -vettool=`which execinquery` ./...

GitHub Actions

- name: install execinqueryrun: go install github.com/lufeee/execinquery
- name: run execinqueryrun: go vet -vettool=`which execinquery` ./...

License

MIT license.


About

A simple query string checker in Query function

Topics

Resources

Stars

10 stars

Watchers

1 watching

Forks

Releases

Contributors

Languages