Help us shape the future of Go! Take the 2026 Go Developer Survey

forbidigo

command module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

README

forbidigo

forbidigo is a Go static analysis tool to forbidigo use of particular identifiers.

Installation

go get -u github.com/ashanbrown/forbidigo

Usage

forbidigo [flags...] patterns... -- packages...

If no patterns are specified, the default pattern of fmt\.Printf.* is used to eliminate debug statememts. By default, functions (and whole files), that are identifies as Godoc examples (https://blog.golang.org/examples) are excluded from checking.

A larger set of interesting patterns might include:

  • fmt\.Printf.* -- forbid use of Printf because it is likely just for debugging
  • fmt\.Errorf -- forbid Errorf in favor of using github.com/pkg/errors
  • ginkgo\.F.* -- forbid ginkgo focused commands (used for debug issues)
  • spew\.Dump -- forbid dumping detailed data to stdout

Note that the linter has no knowledge of what packages were actually imported, so aliased imports will match these patterns.

Flags
  • -set_exit_status (default false) - Set exit status to 1 if any issues are found.
  • -exclude_godoc_examples (default true) - Controls whether godoc examples are identified and excluded

Purpose

To prevent leaving format statements and temporary statements such as Ginkgo FIt, FDescribe, etc.

Ignoring issues

You can ignore a particular issue by including the directive // permit on that line

Contributing

Pull requests welcome!

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
forbidigo provides a linter for forbidding the use of specific identifiers
forbidigo provides a linter for forbidding the use of specific identifiers

Jump to

Keyboard shortcuts

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