port: 8080
package main
import (
"fmt"
"io/ioutil"
"gopkg.in/yaml.v2"
)
type BaseInfo struct {
Port string `yaml:"port"`
}
func main() {
yamlFIle, err := ioutil.ReadFile("./dev.yml")
if err != nil {
fmt.Println(err.Error())
}
b := BaseInfo{}
err = yaml.Unmarshal(yamlFIle, &b)
if err != nil {
fmt.Println(err.Error())
}
fmt.Println(b)
}