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

34 lines
753 B
Go
Raw Normal View History

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"
"github.com/goreleaser/goreleaser/pkg/context"
"github.com/goreleaser/goreleaser/pkg/defaults"
2017-01-14 16:34:22 +02:00
)
// Pipe that sets the defaults
2017-01-14 16:34:22 +02:00
type Pipe struct{}
func (Pipe) String() string {
2018-10-05 14:48:00 +02:00
return "setting defaults"
}
2017-01-14 16:34:22 +02:00
// Run the pipe
func (Pipe) Run(ctx *context.Context) error {
if ctx.Config.Dist == "" {
ctx.Config.Dist = "dist"
}
if ctx.Config.GitHubURLs.Download == "" {
ctx.Config.GitHubURLs.Download = "https://github.com"
}
for _, defaulter := range defaults.Defaulters {
2018-10-05 14:48:00 +02:00
log.Debug(defaulter.String())
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
}