unexportedglobal

command
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

unexportedglobal is a linter for Go code that verifies that unexported global variables and constants are prefixed with '_' in their names.

Usage

To use this linter, run the 'unexportedglobal' binary directly:

$ unexportedglobal ./...

Alternatively, you can use the 'go vet' command:

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

golangci-lint plugin

You can use it as a golangci-lint plugin. First, build it as a plugin:

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

Then enable it in the golangci-lint configuration:

$ cat .golangci.yml
linter-settings:
  custom:
    unexportedglobal:
      path: unexportedglobal.so
      description: Verify unexported globals have an underscore prefix.
      original-url: go.abhg.dev/unexportedglobal

Jump to

Keyboard shortcuts

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