partialfields

package module
v0.0.0-...-3420630 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2021 License: MIT Imports: 11 Imported by: 0

README

go-partialfields

partialfields is a program for the Go language that checks that the fields of structural literals are partially defined.

 🙅‍♀️ Don't use this.
Use exhaustivestruct

Usage

partialfields [-flag] [package]

Just give the package path.

partialfields github.com/kamiaka/partialfields/testdata/src/a

Control errors

Comment

Skip if the struct literal comment starts with // partial.

type Value struct {
  Foo, Bar int
}

// skip check.
var OK = Value{ // partial
  Foo: 1,
}

// requires Bar.
var NG = Value{
  Foo: 1,
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAnalyzer

func NewAnalyzer() *analysis.Analyzer

Types

type IncompleteError

type IncompleteError struct {
	CompositLit *ast.CompositeLit
	Fields      []string
}

func (*IncompleteError) End

func (e *IncompleteError) End() token.Pos

func (*IncompleteError) Error

func (e *IncompleteError) Error() string

func (*IncompleteError) Name

func (e *IncompleteError) Name() string

func (*IncompleteError) Pos

func (e *IncompleteError) Pos() token.Pos

Directories

Path Synopsis
cmd
internal
pkg

Jump to

Keyboard shortcuts

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