mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-10 03:47:03 +02:00
43 lines
769 B
Go
43 lines
769 B
Go
package config
|
|
|
|
import (
|
|
"io/ioutil"
|
|
|
|
yaml "gopkg.in/yaml.v1"
|
|
)
|
|
|
|
// Homebrew contains the brew section
|
|
type Homebrew struct {
|
|
Repo string
|
|
Folder string
|
|
Caveats string
|
|
}
|
|
|
|
// BuildConfig contains the build configuration section
|
|
type BuildConfig struct {
|
|
Oses []string
|
|
Arches []string
|
|
Main string
|
|
Ldflags string
|
|
}
|
|
|
|
// ProjectConfig includes all project configuration
|
|
type ProjectConfig struct {
|
|
Repo string
|
|
BinaryName string `yaml:"binary_name"`
|
|
Files []string
|
|
Brew Homebrew
|
|
Build BuildConfig
|
|
Archive ArchiveConfig
|
|
}
|
|
|
|
// Load config file
|
|
func Load(file string) (config ProjectConfig, err error) {
|
|
data, err := ioutil.ReadFile(file)
|
|
if err != nil {
|
|
return config, err
|
|
}
|
|
err = yaml.Unmarshal(data, &config)
|
|
return
|
|
}
|