mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-08 03:31:59 +02:00
style: improved code a bit
This commit is contained in:
parent
5bc64413de
commit
f3910c9751
@ -194,6 +194,7 @@ type Changelog struct {
|
||||
Sort string `yaml:",omitempty"`
|
||||
}
|
||||
|
||||
// EnvFile is the
|
||||
type EnvFiles struct {
|
||||
GitHubToken string `yaml:"github_token,omitempty"`
|
||||
}
|
||||
|
28
pipeline/env/env.go
vendored
28
pipeline/env/env.go
vendored
@ -52,19 +52,19 @@ func (Pipe) Run(ctx *context.Context) error {
|
||||
|
||||
func loadEnv(env, path string) (string, error) {
|
||||
val := os.Getenv(env)
|
||||
if val == "" {
|
||||
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
|
||||
}
|
||||
val = string(bts)
|
||||
if val != "" {
|
||||
return val, nil
|
||||
}
|
||||
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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user