1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-02-03 13:11:48 +02:00

fix: archive check when project is a library

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
This commit is contained in:
Carlos Alexandro Becker 2020-10-11 13:00:42 -03:00
parent 4471154461
commit 229c8f54a5
2 changed files with 16 additions and 1 deletions

View File

@ -119,7 +119,7 @@ func checkArtifacts(artifacts map[string][]*artifact.Artifact) error {
for _, v := range artifacts {
lens[len(v)] = true
}
if len(lens) == 1 {
if len(lens) <= 1 {
return nil
}
return ErrArchiveDifferentBinaryCount

View File

@ -244,6 +244,21 @@ func TestRunPipeDifferentBinaryCount(t *testing.T) {
require.EqualError(t, Pipe{}.Run(ctx), "invalid archive: 0: "+ErrArchiveDifferentBinaryCount.Error())
}
func TestRunPipeNoBinaries(t *testing.T) {
folder, back := testlib.Mktmp(t)
defer back()
var dist = filepath.Join(folder, "dist")
require.NoError(t, os.Mkdir(dist, 0755))
var ctx = context.New(config.Project{
Dist: dist,
ProjectName: "foobar",
Archives: []config.Archive{{}},
})
ctx.Version = "0.0.1"
ctx.Git.CurrentTag = "v0.0.1"
require.NoError(t, Pipe{}.Run(ctx))
}
func zipFiles(t *testing.T, path string) []string {
f, err := os.Open(path)
require.NoError(t, err)