All Projects → leighmcculloch → gochecknoinits

leighmcculloch / gochecknoinits

Licence: MIT license
Check that no init functions are present in Go code.

Programming Languages

go
31211 projects - #10 most used programming language

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].