Last active
March 17, 2016 01:11
-
-
Save mjs/f0d954eb5b7e6494ae98 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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