FAQ
nope I'm trying to import yaml file to structs.
in the link playground that I gave above my structs looks like this.
type (
Parameters struct {
keys map[string]string
}

Yaml struct {
parameters Parameters
}
)

and the yaml which is also above with gists link looks like

parameters:
     database_driver: pdo_mysql
     database_host: database.local
     database_port: 3306
     database_name: test

I did try alternatives maps etc. even slices arrays already I know not suitable for string keys but it didin't work
On Sunday, February 15, 2015 at 9:13:59 PM UTC+2, Kevin Malachowski wrote:

I'm on mobile so I can't type out any code to help, but what happens if
you use the Marshal functions in the yaml package to turn a Go struct into
yaml?

Also, are you familiar with struct tags?They look like `json:"fieldname"`
for the encoding/json package and are optional for that package, but maybe
the yaml package has a similar feature and can help out.
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 4 of 11 | next ›
Discussion Overview
groupgolang-nuts @
categoriesgo
postedFeb 15, '15 at 7:07p
activeFeb 16, '15 at 4:06a
posts11
users6
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase