Formula Go assumes your software is hosted in GitHub, and the pre-compiled binaries are uploaded in the release page of it.
Step 1: Initialization for your project
Run the following command in the top directory of your project
(same directory as
$ fgo init
homebrew directory and generates a template of Homebrew
Formula Go uses
make to compile and upload your program.
This initialization step creates a
Makefile for this purpose as well as
a template of Homebrew formulae.
To create the template, GitHub's user name and repository name are required.
By default, Formula Go checks your git configuration to obtain
those information but you can give them via arguments
fgo init -h for more information).
If your git configuration doesn't have both information and you don't give them as arguments, this command will skip to create the template. In this case, you need to re-run init command after setting git configuration.
You can edit the Makefile and the template of Homebrew formulae.
release targets in the Makefile are necessary for
Step 2: Build and upload your program
When you're ready for releasing your program as a certain version, run
$ fgo build [version]
It starts to build your program to
pkg directory and uploads built binary
files to GitHub.
After uploading binary files, it updates a Homebrew formula in
For debugging, you may need to build your program but omit uploading.
In this case, omit version name in the above command.
Formula Go builds your program in
pkg/snapshot directory without uploading.
This command takes the following option flags:
This flag specifies a GitHub API token used to upload binaries and create a
release page. If this flag is not given but
variable has been set, the environment variable will be used.
If neither this flag nor
GITHUB_TOKEN are given,
.gitconfig will be used.
This flag specifies a release note for the given version.
If this flag isn't given but your
CHANGELOG.md contains a release note
associated with that version, the release note will be used.
This flag specifies how many goroutines will be used to upload binaries. The default number is as same as the number of CPUs.
If this flag is set and there is a release for the given version, the release will be deleted and a new release for the given version will be created.
If this flag is set, the new release won't be published and will be kept as a draft.
If this flag is set, the new release will be marked as a prerelease.
Update the brew formula without build
fgo update [version] only updates the Homebrew formula for a given version.
build command updates the Homebrew formula but sometimes you may need to re-update it for a specific version. This command do that.
Commands and options
fgo [global options] command [arguments...] COMMANDS: init create Makefile and other related directories. build build binaries, upload them, and update the brew formula. update update the brew formula. help, h Shows a list of commands or help for one command GLOBAL OPTIONS: --pkg NAME, -p NAME directory NAME to store package files (default: "pkg") --brew NAME, -b NAME directory NAME to store homebrew formula (default: "homebrew") --help, -h show help --version, -v print the version
$ brew tap jkawamoto/fgo $ brew install fgo
This software is released under the MIT License, see LICENSE.