Correct printable configuration

This commit is contained in:
9seconds
2019-09-13 10:15:00 +03:00
parent 029245cd16
commit 386522ba22
2 changed files with 15 additions and 1 deletions
+14
View File
@@ -137,6 +137,20 @@ type Config struct {
AdTag []byte `json:"adtag"`
}
func (c Config) Printable() interface{} {
data, err := json.Marshal(c)
if err != nil {
panic(err)
}
rv := map[string]interface{}{}
if err := json.Unmarshal(data, &rv); err != nil {
panic(err)
}
return rv
}
func (c Config) String() string {
data, _ := json.Marshal(c)
return string(data)