Codebase list golang-gomega / 7356360
Build a binary with an expected name (#446) Changes introduced in onsi/gomega#410 is breaking backward compatibility for building binaries with an expected name. Amin Jamali authored 2 years ago GitHub committed 2 years ago
2 changed file(s) with 2 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
22 package gexec
33
44 import (
5 "crypto/md5"
6 "encoding/hex"
75 "errors"
86 "fmt"
97 "go/build"
196194 return "", errors.New("$GOPATH not provided when building " + packagePath)
197195 }
198196
199 hash := md5.Sum([]byte(packagePath))
200 filename := fmt.Sprintf("%s-%x%s", path.Base(packagePath), hex.EncodeToString(hash[:]), strings.Join(suffixes, ""))
201 executable := filepath.Join(tmpDir, filename)
197 executable := filepath.Join(tmpDir, path.Base(packagePath))
202198
203199 if runtime.GOOS == "windows" {
204200 executable += ".exe"
2323 compiledPath, err := gexec.Build(packagePath)
2424 Expect(err).ShouldNot(HaveOccurred())
2525 Expect(compiledPath).Should(BeAnExistingFile())
26 Expect(filepath.Base(compiledPath)).Should(MatchRegexp(`firefly(|.exe)$`))
2627 })
2728
2829 Context("and CleanupBuildArtifacts has been called", func() {