title | homepage | tagline | alias | description |
---|---|---|---|---|
Go |
Go makes it easy to build simple, reliable, and efficient software.
|
go |
Alias for https://webinstall.dev/go.
To update or switch versions, run webi go@stable
(or @v1.21
, @beta
, etc).
~/.config/envman/PATH.env
~/.local/opt/go/
~/go/
Go is designed, through and through, to make Software Engineering easy. It's fast, efficient, reliable, and something you can learn in a weekend.
If you subscribe to The Zen of Python, you'll love > Go.
You may also want to install the Go IDE tooling: go-essentials.
-
Make and enter your project directory
mkdir -p ./hello/cmd/hello pushd ./hello/
-
Initialize your
go.mod
to your git repository url:go mod init github.com/example/hello
-
Create a
hello.go
cat << EOF >> ./cmd/hello/hello.go package main import ( "fmt" ) func main () { fmt.Println("Hello, World!") } EOF
-
Format, build, and run your
./hello
go fmt ./... go build -o hello ./cmd/hello/ ./hello
You should see your output:
> Hello, World!
On Linux:
# Install serviceman (compatible with systemd)
webi serviceman
# go into your programs 'opt' directory
pushd ./hello/
# swap 'hello' and './hello' for the name of your project and binary
sudo env PATH="$PATH" \
serviceman add --system --username "$(whoami)" --name hello -- \
./hello
# Restart the logging service
sudo systemctl restart systemd-journald