Skip to content

Instantly share code, notes, and snippets.

@gagliardetto
Created June 22, 2018 19:39
Show Gist options
  • Select an option

  • Save gagliardetto/d3c45a5cee6d943d5b51439960b082dd to your computer and use it in GitHub Desktop.

Select an option

Save gagliardetto/d3c45a5cee6d943d5b51439960b082dd to your computer and use it in GitHub Desktop.
package main
import (
"encoding/json"
"errors"
"fmt"
)
type Notification struct {
Error error `json:"error"`
}
func main() {
err := errors.New("transmission")
notification := Notification{
Error: err,
}
rawJSON, err := json.Marshal(notification)
if err != nil {
panic(err)
}
fmt.Println(string(rawJSON))
}
@gagliardetto
Copy link
Author

CC @mie00

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment