8000 GitHub - colinking/go-reqfields: Go linter for missing required struct fields. · GitHub
[go: up one dir, main page]

Skip to content

About

Go linter for missing required struct fields.

Topics

Resources

Contributing

Stars

2 stars

Watchers

1 watching

Forks

Latest commit

 

History

8 Commits

Folders and files

Repository files navigation

go-reqfields

Go linter for missing required struct fields.

example

Installation

go get github.com/colinking/go-reqfields

Usage

go run ./cmd/reqfields <pkg | file>
# Example:
go run ./cmd/reqfields ./fixtures/ex1

IDE Integration

You can configure your editor to provide lint warnings from go-reqfields via golangci-lint.

To do that, first download this repo and run go generate ./.... This will generate a Go plugin that golangci-lint will use.

Then, add a .golangci.yml to your repo with the following configuration:

linters-settings:
  custom:
    reqfields:
      # Make sure to update this path to point at your local copy of `colinking/go-reqfields`:
      path: ./cmd/plugin/main.so
      description: Compile-time warnings for required fields.
      original-url: github.com/colinking/go-reqfields

linters:
  enable:
    - reqfields

Finally, configure your editor to use golangci-lint. For example in VSCode, you add the following to your settings file:

"go.lintTool": "golangci-lint",
"go.lintFlags": ["--fast"],

About

Go linter for missing required struct fields.

Topics

Resources

Contributing

Stars

2 stars

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages

0