gochecknoinits

command module
v0.0.0-...-25bb07f Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2021 License: MIT Imports: 8 Imported by: 0

README

gochecknoinits

Build Status Go Report Card

Check that no inits functions are present in Go code.

Why

Init functions cause an import to have side effects, and side effects are hard to test, reduce readability and increase the complexity of code.

https://peter.bourgon.org/blog/2017/06/09/theory-of-modern-go.html https://twitter.com/davecheney/status/871939730761547776

Install

go get 4d63.com/gochecknoinits

Usage

gochecknoinits
gochecknoinits ./...
gochecknoinits [path] [path] [path] [etc]

Add -t to include tests.

gochecknoinits -t [path]

Note: Paths are only inspected recursively if the Go /... recursive path suffix is appended to the path.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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