|
|
|
|
|
by triztian
2217 days ago
|
|
Hey there I found modules to be confusing coming from GOPATH too, but they're straight forward, super barebones example: #!/bin/bash
cd $HOME
# Create project directory
mkdir hellogo
cd hellogo
# Init project modfile
go mod init example.com/hellogo
# Create the main source file
# Uses bash's heredoc
cat << EOF > ./main.go
package main
import "fmt"
func main() {
fmt.Print("Hello world")
}
EOF
# Build it
go build
# Run it
./hellogo
|
|