August 2019
Beginner to intermediate
798 pages
17h 2m
English
Once again, in order to use our Go modules, we will need to create a Go program, which is called useV2.go and contains the following Go code:
package main
import (
v "github.com/mactsouk/myModule/v2"
)
func main() {
v.Version()
}
We are going to use a Docker image. This is the most convenient way of playing with Go modules because we are starting with a clean Go installation:
$ docker run --rm -it golang:latest
root@191d84fc5571:/go# cd /tmp
root@191d84fc5571:/tmp# cat > useV2.go
package main
import (
v "github.com/mactsouk/myModule/v2"
)
func main() {
v.Version()
}
root@191d84fc5571:/tmp# export GO111MODULE=on
root@191d84fc5571:/tmp# go run useV2.go
go: finding github.com/mactsouk/myModule/v2 v2.0.0
go: downloading ...Read now
Unlock full access