requiredfield

command
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

requiredfield is a linter for Go code that checks for missing required fields in struct literals. See top-level package documentation for more information on the linter.

Usage

To use this linter, install the requiredfield binary:

$ go install go.abhg.dev/requiredfield/cmd/requiredfield@latest

Pass the path to this file to 'go vet':

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

As a golangci-lint plugin

Build the plugin:

$ go build -buildmode=plugin go.abhg.dev/requiredfield/cmd/requiredfield

Then enable it in the golangci-lint configuration:

$ cat .golangci.yml
linter-settings:
  custom:
    requiredfield:
      path: requiredfield.so
      description: Checks for required fields in structs
      original-url: go.abhg.dev/requiredfield

Jump to

Keyboard shortcuts

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