mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-24 04:16:27 +02:00
Merge branch 'master' into config
This commit is contained in:
commit
d430d9ed38
@ -26,6 +26,9 @@ func (Pipe) Run(ctx *context.Context) error {
|
||||
for _, goarch := range ctx.Config.Build.Goarch {
|
||||
goos := goos
|
||||
goarch := goarch
|
||||
if !valid(goos, goarch) {
|
||||
continue
|
||||
}
|
||||
name, err := nameFor(ctx, goos, goarch)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -75,3 +78,47 @@ func run(goos, goarch string, command []string) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// list from https://golang.org/doc/install/source#environment
|
||||
var valids = []string{
|
||||
"androidarm",
|
||||
"darwin386",
|
||||
"darwinamd64",
|
||||
"darwinarm",
|
||||
"darwinarm64",
|
||||
"dragonflyamd64",
|
||||
"freebsd386",
|
||||
"freebsdamd64",
|
||||
"freebsdarm",
|
||||
"linux386",
|
||||
"linuxamd64",
|
||||
"linuxarm",
|
||||
"linuxarm64",
|
||||
"linuxppc64",
|
||||
"linuxppc64le",
|
||||
"linuxmips",
|
||||
"linuxmipsle",
|
||||
"linuxmips64",
|
||||
"linuxmips64le",
|
||||
"netbsd386",
|
||||
"netbsdamd64",
|
||||
"netbsdarm",
|
||||
"openbsd386",
|
||||
"openbsdamd64",
|
||||
"openbsdarm",
|
||||
"plan9386",
|
||||
"plan9amd64",
|
||||
"solarisamd64",
|
||||
"windows386",
|
||||
"windowsamd64",
|
||||
}
|
||||
|
||||
func valid(goos, goarch string) bool {
|
||||
var s = goos + goarch
|
||||
for _, a := range valids {
|
||||
if a == s {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
13
pipeline/build/build_test.go
Normal file
13
pipeline/build/build_test.go
Normal file
@ -0,0 +1,13 @@
|
||||
package build
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestValid(t *testing.T) {
|
||||
assert.True(t, valid("windows", "386"))
|
||||
assert.True(t, valid("linux", "386"))
|
||||
assert.False(t, valid("windows", "arm"))
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user