togo/toml.go
John Olheiser e8a896fbac
Initial commit
Signed-off-by: jolheiser <john.olheiser@gmail.com>
2021-04-08 23:58:22 -05:00

18 lines
341 B
Go

package togo
import (
"fmt"
"github.com/pelletier/go-toml"
)
func FromTOML(name string, data []byte) (GoStruct, error) {
var m map[string]interface{}
if err := toml.Unmarshal(data, &m); err != nil {
return GoStruct{}, fmt.Errorf("could not unmarshal TOML: %v", err)
}
gs := ToGo(name, m)
gs.format = tomlFormat
return gs, nil
}