allfields

module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2022 License: MIT

README

allfields

allfields is linter for Go programming language. It checks that all fields in the struct literal are set.

allfields checks only the struct literals with the //allfields comments just inside them. In the following example the linter will throw error because the Age field is not set while creating userAlice, but userBob will successfully pass the checks. To run the allfields linter use the command like go run github.com/subtle-byte/allfields/cmd/go-allfields path/to/packages.

type User struct {
    Name string
    Age int
}

func main() {
    userAlice := User{
        Name: "Alice",
        //allfields
    }
    userBob := User{
        Name: "Bob",
        Age:  20,
        //allfields
    }
}

Directories

Path Synopsis
cmd
go-allfields command
internal
pkg

Jump to

Keyboard shortcuts

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