sqlpassctxcheck

package module
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 12, 2024 License: MIT Imports: 5 Imported by: 0

README

sqlpassctxcheck

sqlpassctxcheck is a program for checking for sql module method call without ctx. Using this tool, you can avoid falling outside of distributed tracing by forgetting to pass the context.

Install

go install github.com/400f/sqlpassctxcheck/cmd/sqlpassctxcheck@latest

Usage

package main

import "database/sql"

func Call(db *sql.DB)  {
  rows, err := db.Query("SELECT * FROM foo")
  if err != nil {
    return err
  }

  // ...
}
$ go vet -vettool=(which sqlpassctxcheck) ./...

main.go:6:15 use (*database/sql.DB).QueryContext instead of (*database/sql.DB).Query

Develop

$ go test -v ./

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Analyzer = &analysis.Analyzer{
	Name: "sqlpassctxcheck",
	Doc:  "check for sql module method call without ctx",
	Run:  run,
	Requires: []*analysis.Analyzer{
		buildssa.Analyzer,
	},
}

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL