Skip to content

devops-ws/golang-guide

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 

Repository files navigation

golang-guide

You could directly run all the code lines via mde.

#!title: JSON Demo
import "fmt"
import "context"
import "encoding/json"

type SimpleObject struct {
	Name        string          `json:"name"`
	Description string          `json:"description"`
    Location string `json:"location,omitempty"`
	Context     context.Context `json:"-"` // will be removed by JSON parsing
}

obj := SimpleObject{
    Name: "name",
    Description: "desc",
}
if data, err := json.Marshal(obj); err == nil {
    fmt.Println(string(data))
} else {
    fmt.Println(err)
}

Releases

No releases published

Packages

No packages published