August 2019
Beginner to intermediate
798 pages
17h 2m
English
We will need to execute the following commands to create v1.0.0 of our basic Go module:
$ go mod init go: creating new go.mod: module github.com/mactsouk/myModule $ touch myModule.go $ vi myModule.go $ git add . $ git commit -a -m "Initial version 1.0.0" $ git push $ git tag v1.0.0 $ git push -q origin v1.0.0 $ go list github.com/mactsouk/myModule $ go list -m github.com/mactsouk/myModule
The contents of myModule.go will be as follows:
package myModule
import (
"fmt"
)
func Version() {
fmt.Println("Version 1.0.0")
}
The contents of go.mod, which was created previously, will be as follows:
$ cat go.mod
module github.com/mactsouk/myModule
go 1.12
Read now
Unlock full access