Skip to content

Instantly share code, notes, and snippets.

View adriacidre's full-sized avatar

Adrià Cidre adriacidre

View GitHub Profile
litter.Dump(cart)
/*
&main.Cart{
Account: 1,
Fruits: []string{
"apple",
"peach",
"pear",
},
}
spew.Dump(cart)
/*
(*main.Cart)(0xc0000aa120)({
Account: (int) 1,
Fruits: ([]string) (len=3 cap=3) {
(string) (len=5) "apple",
(string) (len=5) "peach",
(string) (len=4) "pear"
}
})
jcart, _ := json.MarshalIndent(cart, "", "\t")
fmt.Println(string(jcart))
/*
{
"account_number": 1,
"fruits": [
"apple",
"peach",
"pear"
]
jcart, _ := json.Marshal(cart)
fmt.Println(string(jcart))
// {"account_number":1,"fruits":["apple","peach","pear"]}
fmt.Printf("%#v\n", cart)
// &main.Cart{Account:1, Fruits:[]string{"apple", "peach", "pear"}}
fmt.Printf("%+v\n", cart)
// &{Account:1 Fruits:[apple peach pear]}
@adriacidre
adriacidre / cart-example.go
Last active June 4, 2020 08:43
Cart example
type Cart struct {
Account int `json:"account_number"`
Fruits []string `json:"fruits"`
}
cart := &Cart{
Account: 1,
Fruits: []string{"apple", "peach", "pear"}}
}

Keybase proof

I hereby claim:

  • I am adriacidre on github.
  • I am kumulo (https://keybase.io/kumulo) on keybase.
  • I have a public key ASBM169TXG0MNhX3RpK19w_OV_RrxIHIE7Rf3CCnfC-qbQo

To claim this, I am signing this object:

{
"arcs": [
{
"from": "initialized",
"to": "verification_pending",
"when": "verify"
},
{
"from": "verification_pending",
"to": "to_transcode",
nc, _ := nats.Connect(nats.DefaultURL)
body := []byte(`{"status":"verification_pending", "verification_done"}`)
msg, err := nc.Request("workflow.get.next", body, 10*time.Millisecond)
nc.Close();