An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.

github.com/sourcegraph/gostringer

Gostringer is a tool to automate the creation of methods that satisfy the fmt.GoStringer interface. Given the name of a (signed or unsigned) integer type T that has constants defined, gostringer will create a new self-contained Go source file implementing The file is created in the same package and directory as the package that defines T. It has helpful defaults designed for use with go generate. Gostringer works best with constants that are consecutive values such as created using iota, but creates good code regardless. In the future it might also provide custom support for constant sets that are bit patterns. For example, given this snippet, running this command in the same directory will create the file pill_gostring.go, in package painkiller, containing a definition of That method will translate the value of a Pill constant to the Go syntax representation of the respective constant name, so that the call fmt.Print(painkiller.Aspirin) will print the string "painkiller.Aspirin". Typically this process would be run using go generate, like this: If multiple constants have the same value, the lexically first matching name will be used (in the example, Acetaminophen will print as "painkiller.Paracetamol"). With no arguments, it processes the package in the current directory. Otherwise, the arguments must name a single directory holding a Go package or a set of Go source files that represent a single Go package. The -type flag accepts a comma-separated list of types so a single run can generate methods for multiple types. The default output file is t_gostring.go, where t is the lower-cased name of the first type listed. It can be overridden with the -output flag.

Ecosystem
proxy.golang.org
Latest Release
v0.0.0-20170412223530-cd0142490e8a
almost 9 years ago
Versions
1
Dependent Repos
1
Links
Registry proxy.golang.org
Source Repository
Docs Documentation
JSON API View JSON
CodeMeta codemeta.json
Package Details
PURL pkg:golang/github.com/sourcegraph/gostringer
spec
License BSD-3-Clause
Namespace github.com/sourcegraph
First Release almost 9 years ago
Last Synced 14 days ago
Repository
Stars 4 on GitHub
Forks 2 on GitHub
Rankings on proxy.golang.org
Overall Top 9.7%
Dependent repos Top 4.7%