2017-04-14 20:39:32 +02:00
|
|
|
// Package defaults implements the Pipe interface providing default values
|
|
|
|
// for missing configuration.
|
2017-01-14 16:34:22 +02:00
|
|
|
package defaults
|
|
|
|
|
|
|
|
import (
|
2017-06-28 00:20:08 +02:00
|
|
|
"github.com/apex/log"
|
2018-08-15 04:50:20 +02:00
|
|
|
"github.com/goreleaser/goreleaser/pkg/context"
|
2018-10-26 16:03:55 +02:00
|
|
|
"github.com/goreleaser/goreleaser/pkg/defaults"
|
2017-01-14 16:34:22 +02:00
|
|
|
)
|
|
|
|
|
2017-12-10 15:28:01 +02:00
|
|
|
// Pipe that sets the defaults
|
2017-01-14 16:34:22 +02:00
|
|
|
type Pipe struct{}
|
|
|
|
|
2017-12-02 23:53:19 +02:00
|
|
|
func (Pipe) String() string {
|
2018-10-05 14:48:00 +02:00
|
|
|
return "setting defaults"
|
2017-12-02 23:53:19 +02:00
|
|
|
}
|
|
|
|
|
2017-01-14 16:34:22 +02:00
|
|
|
// Run the pipe
|
2017-12-02 23:53:19 +02:00
|
|
|
func (Pipe) Run(ctx *context.Context) error {
|
2017-11-27 01:25:51 +02:00
|
|
|
if ctx.Config.Dist == "" {
|
|
|
|
ctx.Config.Dist = "dist"
|
|
|
|
}
|
2018-03-08 22:16:49 +02:00
|
|
|
if ctx.Config.GitHubURLs.Download == "" {
|
|
|
|
ctx.Config.GitHubURLs.Download = "https://github.com"
|
|
|
|
}
|
2018-10-26 16:03:55 +02:00
|
|
|
for _, defaulter := range defaults.Defaulters {
|
2018-10-05 14:48:00 +02:00
|
|
|
log.Debug(defaulter.String())
|
2017-12-02 23:53:19 +02:00
|
|
|
if err := defaulter.Default(ctx); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2017-05-01 14:59:18 +02:00
|
|
|
}
|
2017-01-14 20:41:32 +02:00
|
|
|
return nil
|
2017-01-14 16:34:22 +02:00
|
|
|
}
|