Skip to Main Content
Go Cookbook
book

Go Cookbook

by Aaron Torres
June 2017
Intermediate to advanced content levelIntermediate to advanced
400 pages
10h 32m
English
Packt Publishing
Content preview from Go Cookbook

How to do it...

These steps cover writing and running your application:

  1. From your terminal/console application, create and navigate to the chapter3/nulls directory.
  2. 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.
  3. 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() ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Go Cookbook

Go Cookbook

Sau Sheong Chang
Mastering Go

Mastering Go

Mina Andrawos

Publisher Resources

ISBN: 9781783286836Supplemental Content