1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-02-03 13:11:48 +02:00
goreleaser/pkg/build/build.go
Carlos Alexandro Becker 032a105533
feat: validate goos, goarch, goarm and gomips (#1886)
* feat: validate goos, goarch, goarm and gomips

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* fix: lint

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2020-11-05 07:20:14 +00:00

39 lines
849 B
Go

// Package build provides the API for external builders
package build
import (
"sync"
"github.com/goreleaser/goreleaser/pkg/config"
"github.com/goreleaser/goreleaser/pkg/context"
)
// nolint: gochecknoglobals
var (
builders = map[string]Builder{}
lock sync.Mutex
)
// Register registers a builder to a given lang.
func Register(lang string, builder Builder) {
lock.Lock()
builders[lang] = builder
lock.Unlock()
}
// For gets the previously registered builder for the given lang.
func For(lang string) Builder {
return builders[lang]
}
// Options to be passed down to a builder.
type Options struct {
Name, Path, Ext, Target, Os, Arch string
}
// Builder defines a builder.
type Builder interface {
WithDefaults(build config.Build) (config.Build, error)
Build(ctx *context.Context, build config.Build, options Options) error
}