8000 staticcheck: detect mismatching numbers of SQL bind parameters for certain scenarios · Issue #532 · dominikh/go-tools · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
staticcheck: detect mismatching numbers of SQL bind parameters for certain scenarios #532
Open
@fortytw2

Description

@fortytw2

I've had cases like this ->

row := db.sql.QueryRowContext(ctx, `
	INSERT INTO source_creation_requests
	(user_id, input_url)
	VALUES
	($1, $2, $3)`, st, inputURL)

pop up many times in the past, where there are 3 bindVars in the query string, but only 2 get passed from Go.

I think there's a limited subset of this check that shouldn't have any false positives (i.e. a fixed length of sql args, a single static string as the query), would be really useful to be able to check this before runtime.

Metadata

Metadata

Assignees

No one assigned

    Labels

    aggressiveA set of checks that is more prone to false positives but is helpful during code reviewnew-check

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0