mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-03-31 21:55:34 +02:00
The PR enables [`nolintlint`](https://golangci-lint.run/usage/linters/#nolintlint) linter and fixes up appeared issues. Changes: - Enable `nolintlint` in `.golangci.yml` config. - Remove unused `//nolint:` comments. - Fix `nolint` comment format by removing spaces (`// nolint: dupl` -> `//nolint:dupl`) Co-authored-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
47 lines
949 B
Go
47 lines
949 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 name.
|
|
func Register(name string, builder Builder) {
|
|
lock.Lock()
|
|
builders[name] = builder
|
|
lock.Unlock()
|
|
}
|
|
|
|
// For gets the previously registered builder for the given name.
|
|
func For(name string) Builder {
|
|
return builders[name]
|
|
}
|
|
|
|
// Options to be passed down to a builder.
|
|
type Options struct {
|
|
Name string
|
|
Path string
|
|
Ext string
|
|
Target string
|
|
Goos string
|
|
Goarch string
|
|
Goamd64 string
|
|
Goarm string
|
|
Gomips 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
|
|
}
|