Generate consistent Go package headers every time.
You need Go installed on your machine. See the installation guide here.
Install the CLI globally like this:
git clone github.com/Jesserc/package-headers-go
cd package-headers-go/cmd/package-headers-go
go install .
Run: source ~/.zshrc
or source ~/.bashrc
to reload zsh/bash config.
Generate a Go package header and copy it to your clipboard:
package-headers-go -package reverser -description "Utility function for reversing strings." -example "import \"github.com/example/reverser\"\n\nstr := \"hello\"\nreversedStr := reverser.ReverseString(str)\nfmt.Println(reversedStr) // Output: \"olleh\""
This will generate a header like:
/*
Package reverser provides Utility function for reversing strings.
import "github.com/example/reverser"
str := "hello"
reversedStr := reverser.ReverseString(str)
fmt.Println(reversedStr) // Output: "olleh"
*/
package reverser
And it will automatically copy the header to your clipboard.
Inspired by t11's headers
.