Created
June 13, 2014 05:15
-
-
Save RichMorin/27dfb7404ee69c1a87e2 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
// yaml_fu.go - try out YAML library | |
// | |
// Written by Rich Morin, CFCL, 2014 | |
package main | |
import ("fmt"; "log") | |
import "gopkg.in/yaml.v1" | |
type T map[string] map[string] [4]string | |
func main () { | |
yaml_text := ` | |
Predicates: | |
# ns_name P PT I Expansion | |
owl_disjointWith: [ _, __, _, 'disjoint with' ] | |
owl_equivalentClass: [ _, __, _, 'equivalent class' ] | |
` | |
t := T{} | |
err := yaml.Unmarshal([]byte(yaml_text), &t) | |
fmt.Printf("yaml_text: '%s'\n", yaml_text) | |
fmt.Printf("--- t:\n%v\n\n", t ) | |
d, err := yaml.Marshal(&t) | |
log.Fatalf("error: %v", err) //T | |
if err != nil { log.Fatalf("error: %v", err) } | |
fmt.Printf("--- t dump:\n%s\n\n", string(d)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment