These steps cover writing and running your application:
- From your terminal/console application, create and navigate to the chapter3/nulls directory.
- Copy tests from https://github.com/agtorre/go-cookbook/tree/master/chapter3/nulls or use this as an exercise to write some of your own code.
- Create a file called base.go with the following contents:
package nulls import ( "encoding/json" "fmt" ) // json that has name but not age const ( jsonBlob = `{"name": "Aaron"}` fulljsonBlob = `{"name":"Aaron", "age":0}` ) // Example is a basic struct with age // and name fields type Example struct { Age int `json:"age,omitempty"` Name string `json:"name"` } // BaseEncoding shows encoding and // decoding with normal types func BaseEncoding() ...