Command Line Utility to create Hello World apps.
Instructions: https://golang.org/doc/install
In your .zshrc
or .bashrc
file, append your system’s $PATH so that the command can be invoked from anywhere.
export PATH=${PATH}:$HOME/go/bin
Restart your terminal once to source them into your machine environment or just source ~/.zshrc
.
To install cobra, run:
go get -u github.com/spf13/cobra/cobra
You can run cobra help
or just cobra
to get more familiar with it.
[Reference: https://dzone.com/articles/how-to-create-a-cli-in-go-in-few-minutes]
After cloning the repo, go to the project's directory (HelloWorld) and run:
One Time Commands:
- go mod init HelloWorld
- go build
- go install HelloWorld
After editing files to run the command to reflect the new changes, run:
- go install HelloWorld to build the new version.
This project also uses to create binary files of the hello world files in different languages: https://github.com/go-bindata/go-bindata
After adding a new file in cmd/data for a new language To install that, run:
- go get -u github.com/go-bindata/go-bindata/...
- go-bindata data/
Then install the module again.
Example -
Run HelloWorld create NodeJS
a nodeJS Hello World app gets created in the home directory.