Skip to content
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

fix(vet): query.cmd was always set to ":" #2525

Merged
merged 1 commit into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion docs/howto/vet.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ message Query
string sql = 1;
// Name of the query
string name = 2;
// One of :many, :one, :exec, etc.
// One of "many", "one", "exec", etc.
string cmd = 3;
// Query parameters, if any
repeated Parameter params = 4;
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/vet.go
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ func vetQuery(q *plugin.Query) *vet.Query {
return &vet.Query{
Sql: q.Text,
Name: q.Name,
Cmd: strings.TrimPrefix(":", q.Cmd),
Cmd: strings.TrimPrefix(q.Cmd, ":"),
Params: params,
}
}
Expand Down
1 change: 1 addition & 0 deletions internal/endtoend/testdata/vet_failures/stderr.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ query.sql: CreateAuthor: no-pg: invalid engine: postgresql
query.sql: CreateAuthor: only-one-param: too many parameters
query.sql: DeleteAuthor: no-pg: invalid engine: postgresql
query.sql: DeleteAuthor: no-delete: don't use delete statements
query.sql: DeleteAuthor: no-exec: don't use exec