chainvet

command
v0.0.0-...-6d4bf48 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2023 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

chainvet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string. chainvet uses heuristics that do not guarantee all reports are genuine problems, but it can find errors not caught by the compilers.

It can be invoked two ways:

By files:

chainvet source/directory/*.go

vets the files named, all of which must be in the same package.

By directory:

chainvet source/directory

recursively descends the directory, vetting each package it finds.

chainvet's exit code is 2 for erroneous invocation of the tool, 1 if a problem was reported, and 0 otherwise. Note that the tool does not check every possible problem and depends on unreliable heuristics so it should be used as guidance only, not as a firm indicator of program correctness.

By default all checks are performed. If any flags are explicitly set to true, only those tests are run. Conversely, if any flag is explicitly set to false, only those tests are disabled. Thus -printf=true runs the printf check, -printf=false runs all checks except the printf check.

Available checks:

Parity of log.Write and log.Fatal

Flag: -logparity

Calls to chain/log.Write that have an odd number of key/value arguments.

Use of http.DefaultClient

Flag: -defaulthttp

Calls to http.DefaultClient in Chain packages that should be using a TLS-configured http client.

Other flags

These flags configure the behavior of chainvet:

-all (default true)
	Check everything; disabled if any explicit check is requested.
-v
	Verbose mode

chainvet is a simple checker for static errors in Go source code. See doc.go for more information.

Jump to

Keyboard shortcuts

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