Skip to content

Commit

Permalink
Fix compilation for non-modules (cucumber#436)
Browse files Browse the repository at this point in the history
  • Loading branch information
vearutop authored Oct 14, 2021
1 parent 239a424 commit 86a5635
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ This document is formatted according to the principles of [Keep A CHANGELOG](htt

---

## [v0.12.2]

### Fixed

- Error in `go mod tidy` with `GO111MODULE=off` ([436]((https://github.com/cucumber/godog/pull/436) - [vearutop])

## [v0.12.1]

### Fixed
Expand Down Expand Up @@ -196,6 +202,7 @@ This document is formatted according to the principles of [Keep A CHANGELOG](htt

<!-- Releases -->

[v0.12.2]: https://github.com/cucumber/godog/compare/v0.12.1...v0.12.2
[v0.12.1]: https://github.com/cucumber/godog/compare/v0.12.0...v0.12.1
[v0.12.0]: https://github.com/cucumber/godog/compare/v0.11.0...v0.12.0
[v0.11.0]: https://github.com/cucumber/godog/compare/v0.10.0...v0.11.0
Expand Down
8 changes: 5 additions & 3 deletions internal/builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,11 @@ func Build(bin string) error {
// we also print back the temp WORK directory
// go has built. We will reuse it for our suite workdir.
temp := fmt.Sprintf(filepath.Join("%s", "temp-%d.test"), os.TempDir(), time.Now().UnixNano())
modTidyOutput, err := exec.Command("go", "mod", "tidy").CombinedOutput()
if err != nil {
return fmt.Errorf("failed to tidy modules in tested package: %s, reason: %v, output: %s", abs, err, string(modTidyOutput))
if os.Getenv("GO111MODULE") != "off" {
modTidyOutput, err := exec.Command("go", "mod", "tidy").CombinedOutput()
if err != nil {
return fmt.Errorf("failed to tidy modules in tested package: %s, reason: %v, output: %s", abs, err, string(modTidyOutput))
}
}
testOutput, err := exec.Command("go", "test", "-c", "-work", "-o", temp).CombinedOutput()
if err != nil {
Expand Down

0 comments on commit 86a5635

Please sign in to comment.