gocontract

command module
v0.0.0-...-44a96fa Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2018 License: MIT Imports: 9 Imported by: 0

README

gocontract

gocontract is a very simple utility which detects uninitialized and struct fields in a Go file. Detection is opt-in.

Usage

gocontract [file]

    file    Go source file.

Example

Input file: example.go

package example

type Abc struct {
	val *int `json:"config" require:"assignment,NewAbc ,  NewAbcOther"`
}

func NewAbc() Abc {
	val := 42
	return Abc{
		val: &val}
}

func NewAbcOther() *Abc {
	return &Abc{}
}

Output:

./gocontract example.go
example.go uninitialized struct field Abc.val in NewAbcOther

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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