1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-03-17 20:47:50 +02:00

Add LoadReader function

This commit is contained in:
nickg 2017-05-10 19:14:17 -07:00
parent 5eee70de8b
commit bb32b91081

View File

@ -3,6 +3,7 @@
package config
import (
"io"
"io/ioutil"
yaml "gopkg.in/yaml.v1"
@ -116,3 +117,13 @@ func Load(file string) (config Project, err error) {
err = yaml.Unmarshal(data, &config)
return
}
// Load config via io.Reader
func LoadReader(fd io.Reader) (config Project, err error) {
data, err := ioutil.ReadAll(fd)
if err != nil {
return config, err
}
err = yaml.Unmarshal(data, &config)
return
}