Skip to content

Instantly share code, notes, and snippets.

@mjs
Last active March 17, 2016 01:11
Show Gist options
  • Save mjs/f0d954eb5b7e6494ae98 to your computer and use it in GitHub Desktop.
Save mjs/f0d954eb5b7e6494ae98 to your computer and use it in GitHub Desktop.
package foo
import "fmt"
func NewThing() *Thing {
return &Thing{
Name: "Thing",
other: make(other),
}
}
type Thing struct {
Name string
other
}
type other map[string]string
func (o *other) Set(k, v string) {
*o[k] = v
}
func (o *other) Dump() {
for k, v := range *o {
fmt.Println(k + "=" + v)
}
}
/*
func (o *other) MarshalYAML() (interface{}, error) {
return o.data, nil
}
func (o *other) UnmarshalYAML(unmarshal func(interface{}) error) error {
var out map[string]string
err := unmarshal(&out)
if err != nil {
return err
}
o.data = out
return nil
}
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment