diff --git a/Gopkg.lock b/Gopkg.lock index 2b969283d..1a10f6f79 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -16,6 +16,12 @@ revision = "70dc48d5d792f20f684a8f1d29bbac298f4b2ef4" version = "v1.0.0" +[[projects]] + branch = "master" + name = "github.com/campoy/unique" + packages = ["."] + revision = "8da0a74979c676510b9de445041ce14b6e450e24" + [[projects]] name = "github.com/davecgh/go-spew" packages = ["spew"] @@ -53,8 +59,8 @@ "tar", "zip" ] - revision = "407d9188600f1b6584964bc532a5ce882cefdaba" - version = "v1.0.1" + revision = "35c6d4e271a22e46cc7133b7a6ae58b8e52acc01" + version = "v1.0.2" [[projects]] name = "github.com/masterminds/semver" @@ -160,6 +166,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "29cc5012bc98dd429a87d7a638a221b2d0f5b12eaf5bea67576ffd362d88105b" + inputs-digest = "dd48a71cfd5292f26507d405996eb4ee06aea79c2308e6ee16e54fa6cd493832" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index 436b5a69e..b45e0f79d 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -47,3 +47,7 @@ [[constraint]] name = "github.com/fatih/color" version = "1.5.0" + +[[constraint]] + branch = "master" + name = "github.com/campoy/unique" diff --git a/pipeline/archive/archive.go b/pipeline/archive/archive.go index 63d1380c3..354f0c29f 100644 --- a/pipeline/archive/archive.go +++ b/pipeline/archive/archive.go @@ -10,6 +10,7 @@ import ( "strings" "github.com/apex/log" + "github.com/campoy/unique" "github.com/mattn/go-zglob" "golang.org/x/sync/errgroup" @@ -99,12 +100,15 @@ func create(ctx *context.Context, binaries []artifact.Artifact) error { return fmt.Errorf("failed to find files to archive: %s", err.Error()) } for _, f := range files { + log.Debugf("adding %s", f) if err = a.Add(wrap(ctx, f, folder), f); err != nil { return fmt.Errorf("failed to add %s to the archive: %s", f, err.Error()) } } for _, binary := range binaries { - if err := a.Add(wrap(ctx, binary.Name, folder), binary.Path); err != nil { + var bin = wrap(ctx, binary.Name, folder) + log.Debugf("adding %s", bin) + if err := a.Add(bin, binary.Path); err != nil { return fmt.Errorf("failed to add %s -> %s to the archive: %s", binary.Path, binary.Name, err.Error()) } } @@ -142,6 +146,10 @@ func findFiles(ctx *context.Context) (result []string, err error) { } result = append(result, files...) } + // remove duplicates + unique.Slice(&result, func(i, j int) bool { + return strings.Compare(result[i], result[j]) < 0 + }) return }