- Have the following in
gomoduletest-cmd/main.go
:package main import ( "fmt" "github.com/ssilva/gomoduletest" ) func main() { fmt.Println(gomoduletest.Greet("")) fmt.Println(gomoduletest.Greet("John")) }
- Enable modules.
$ cd gomoduletest-cmd $ go mod init cmd go: creating new go.mod: module cmd
- Run it
$ go run main.go Hello, World! Hello, John!
- Get a specific version of the module
$ go get github.com/ssilva/gomoduletest@v1.0.0 $ go run main.go Hello, ! Hello, John!