These steps cover writing and running your application:
- From your terminal/console application, create the chapter13/vendoring directory and navigate to it.
- Copy tests from https://github.com/agtorre/go-cookbook/tree/master/chapter13/vendoring or use this as an exercise to write some of your own code.
- Create a directory named models and navigate to it.
- Create a file called models.go with the following content:
package models import "sync/atomic" // DB Interface is our storage // layer type DB interface { GetScore() (int64, error) SetScore(int64) error } // NewDB returns our db struct that // satisfies DB interface func NewDB() DB { return &db{0} } type db struct { score int64 } // GetScore returns the score atomically ...