template for go cli setup for github
The path of go install <github path>
should be the url endpoints of the github project,
go install github.com/<username>/<project>
Please use the readme example below as an example
Important note is that when you run go mod init
, you will need to use lthe github url endpoint for the project as pointed out in the selection above.
For example, for this project the github url endpoint will be github.com/epicseven-cup/go-cli-template
So when you will need to run go mod init github.com/epicseven-cup/go-cli-template
When you run go install github.com/epicseven-cup/go-cli-template@latest
, but default it will go by the main.go file that is located in the root of the repository.
You can also point the location to another main.go file by changing the file path examples if you have cmd/go-cli-template/main.go
you can use:
go install github.com/epicseven-cup/go-cli-template/cmd/go-cli-template@latest
- You will need to install go on your machine: https://go.dev/doc/install
- Setup GOPATH
Add the following to your shell config
export PATH=${PATH}:$HOME/go/bin
More information: https://go.dev/wiki/GOPATH#gopath-variable
- Install the binary
go install github.com/epicseven-cup/go-cli-template@latest
There could be delays between the Goproxy and GitHub binarys, you can use the direct setup
GOPROXY=direct go install github.com/epicseven-cup/go-cli-template@latest