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

Rewrite sqlvet using the analyzer framework. #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Dec 11, 2021

  1. Rewrite sqlvet using the analyzer framework.

    Use golang.org/x/tools/go/analysis framework. It's simpler, faster.  It also
    allows analyzing individual packages, not the whole program.
    
    As a simple benchmark, running the sqlvet (old or new) on a 100kloc source takes
    about 10s.  Analyzing a single file in that source takes <1s.
    
    This PR introduces a few incompatible changes:
    
    - The commandline format changes. It's now
    
        sqlvet [-f sqlvet.toml] packages...
    
      The sqlvet.toml file must be in ".", or its location must be explicitly
      specified by the new "-f" flag. This commandline format is compatible with by
      most other analyzers, including govet and staticcheck.
    
      The old `sqlvet <dir>` command becomes:
    
      cd <dir> && sqlvet ./...
    
    - It removes the support for string concatenation.
    
      db.Query("SELECT" + " 1")
    
      won't work any more. I personally think this isn't that big deal, we can
      easily rewrite it using a `raw string`.
    yasushi-saito committed Dec 11, 2021
    Configuration menu
    Copy the full SHA
    42482fc View commit details
    Browse the repository at this point in the history