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

style: improved code a bit

This commit is contained in:
Carlos Alexandro Becker 2018-02-03 00:16:30 -02:00 committed by Carlos Alexandro Becker
parent 5bc64413de
commit f3910c9751
2 changed files with 15 additions and 14 deletions

View File

@ -194,6 +194,7 @@ type Changelog struct {
Sort string `yaml:",omitempty"` Sort string `yaml:",omitempty"`
} }
// EnvFile is the
type EnvFiles struct { type EnvFiles struct {
GitHubToken string `yaml:"github_token,omitempty"` GitHubToken string `yaml:"github_token,omitempty"`
} }

28
pipeline/env/env.go vendored
View File

@ -52,19 +52,19 @@ func (Pipe) Run(ctx *context.Context) error {
func loadEnv(env, path string) (string, error) { func loadEnv(env, path string) (string, error) {
val := os.Getenv(env) val := os.Getenv(env)
if val == "" { if val != "" {
path, err := homedir.Expand(path) return val, nil
if err != nil {
return "", err
}
if _, err := os.Stat(path); os.IsNotExist(err) {
return "", nil
}
bts, err := ioutil.ReadFile(path)
if err != nil {
return "", err
}
val = string(bts)
} }
return val, nil path, err := homedir.Expand(path)
if err != nil {
return "", err
}
if _, err := os.Stat(path); os.IsNotExist(err) {
return "", nil
}
bts, err := ioutil.ReadFile(path)
if err != nil {
return "", err
}
return string(bts), nil
} }