github.phpd.cn/goreleaser/goreleaser@v0.92.0/internal/pipe/defaults/defaults.go (about) 1 // Package defaults implements the Pipe interface providing default values 2 // for missing configuration. 3 package defaults 4 5 import ( 6 "github.com/apex/log" 7 "github.com/goreleaser/goreleaser/pkg/context" 8 "github.com/goreleaser/goreleaser/pkg/defaults" 9 ) 10 11 // Pipe that sets the defaults 12 type Pipe struct{} 13 14 func (Pipe) String() string { 15 return "setting defaults" 16 } 17 18 // Run the pipe 19 func (Pipe) Run(ctx *context.Context) error { 20 if ctx.Config.Dist == "" { 21 ctx.Config.Dist = "dist" 22 } 23 if ctx.Config.GitHubURLs.Download == "" { 24 ctx.Config.GitHubURLs.Download = "https://github.com" 25 } 26 for _, defaulter := range defaults.Defaulters { 27 log.Debug(defaulter.String()) 28 if err := defaulter.Default(ctx); err != nil { 29 return err 30 } 31 } 32 return nil 33 }