zapvet

command module
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2021 License: MIT Imports: 2 Imported by: 0

README

zapvet

pkg.go.dev

zapvet is static analysis tool for zap.

  • fieldtype: fieldtype finds confliction type of field

Install

You can get zapvet by go install command (Go 1.16 and higher).

$ go install github.com/gostaticanalysis/zapvet@latest

How to use

zapvet run with go vet as below when Go is 1.12 and higher.

$ go vet -vettool=$(which zapvet) ./...

Analyzers

fieldtype

fieldtype finds confliction type of field.

package a

import "go.uber.org/zap"

func f() {
	zap.String("id", "100")
	zap.Int("id", 100)       // want `"id" conflict type Int vs String`
	zap.Any("id", "100")     // OK - ignore
	zap.Reflect("id", "100") // OK - ignore
	zap.String("xxx", "100") // OK
}

Analyze with golang.org/x/tools/go/analysis

You can get analyzers of zapvet from zapvet.Analyzers. And you can use them with unitchecker.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
passes

Jump to

Keyboard shortcuts

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