A Go 1.11 demo repository.
Simple module initialized with
export GO111MODULE=on
go mod init
This creates a go.mod
file.
After pushing the repository to github we can create a consumer module.
package main
import "github.com/youruser/shinable"
func main() {
println("Is it shiny?", shinable.Shinable("Shiny"))
}
Initialize the above module as well with
go mod init consumer
Then build and pull dependencies with go build
.
Notice that within the go.mod
file shinable
is annotated with an "anonymous" version.
Update shinable
with new code and push it.
The consumer won’t get the new version until you run go get -u
.
At this point we can also push tag v1.0.0
to shinable
. Notice the importance of v
prefix.
Still the consumer will only be updated with the latest version of shinable
when we run go get -u
.