August 2019
Beginner to intermediate
798 pages
17h 2m
English
In this section, you are going to learn how to use v1.0.0 of the Go module we created earlier. In order to use our Go modules, we will need to create a Go program, which in this case will be called useModule.go and will contain the following Go code:
package main
import (
v1 "github.com/mactsouk/myModule"
)
func main() {
v1.Version()
}
You will need to include the path of the Go module (github.com/mactsouk/myModule) – in this case the Go module also has an alias (v1). Using aliases for packages is highly irregular in Go; however, in this example it makes the code easier to read. Nevertheless, this feature should not be used on production code without a really good reason.
If you just try to execute useModule.go, which ...
Read now
Unlock full access