12345678910111213141516171819202122 |
- package config
- import (
- "gopkg.in/yaml.v2"
- "io/ioutil"
- )
- func readBytes(path string) []byte {
- bytes, err := ioutil.ReadFile(path)
- if err != nil {
- panic(err)
- }
- return bytes
- }
- func readConfig[T any](path string, ptr *T) {
- bytes := readBytes(path)
- err := yaml.Unmarshal(bytes, ptr)
- if err != nil {
- panic(err)
- }
- }
|