gyaml is a Go library for parsing and unmarshaling YAML files into Go structs. It supports loading data from files or directly from strings.
- YAML parsing and reading
- Support for nested structures
- Automatic value conversion
- Array handling
To install the library, use:
go get github.com/henriquemps/gyamlpackage main
import (
"fmt"
"log"
"github.com/henriquemps/gyaml"
)
type Config struct {
Version string `yaml:"version"`
App struct {
Name string `yaml:"name"`
} `yaml:"app"`
}
func main() {
var config Config
gyaml.FUnmarshal(&config, "config.yaml")
fmt.Println("App Name:", config.App.Name)
}package main
import (
"fmt"
"log"
"github.com/henriquemps/gyaml"
)
type Config struct {
Version string `yaml:"version"`
App struct {
Name string `yaml:"name"`
} `yaml:"app"`
}
func main() {
yamlContent := `
version: 1.0.0
app:
name: SampleApp
`
var config Config
gyaml.Unmarshal(&config, yamlContent)
fmt.Println("App Name:", config.App.Name)
}Loads a YAML file and deserializes its content into a Go struct.
Reads and processes a YAML provided as a string.
This project is licensed under the MIT license. See the LICENSE file for more details.