Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/noamt/shinable

An example Go module for my talk at the Go Israel meetup
https://github.com/noamt/shinable

Last synced: 16 days ago
JSON representation

An example Go module for my talk at the Go Israel meetup

Awesome Lists containing this project

README

        

= Shinable

A Go 1.11 demo repository.

== One
Simple module initialized with

[source,bash]
----
export GO111MODULE=on
go mod init
----
This creates a `go.mod` file.

After pushing the repository to github we can create a consumer module.

.consumer.go
[source,go]
----
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.

== Two
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`.

== Three
In this stage the API has been broken and has been pushed as tag `v2.0.0`.
Updating the consumer won't break it, but can be updated with
[source,go]
----
import "github.com/youruser/shinable/v2"
----