Skip to content

Commit 86a5635

Browse files
authored
Fix compilation for non-modules (#436)
1 parent 239a424 commit 86a5635

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ This document is formatted according to the principles of [Keep A CHANGELOG](htt
88

99
---
1010

11+
## [v0.12.2]
12+
13+
### Fixed
14+
15+
- Error in `go mod tidy` with `GO111MODULE=off` ([436]((https://github.com/cucumber/godog/pull/436) - [vearutop])
16+
1117
## [v0.12.1]
1218

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

197203
<!-- Releases -->
198204

205+
[v0.12.2]: https://github.com/cucumber/godog/compare/v0.12.1...v0.12.2
199206
[v0.12.1]: https://github.com/cucumber/godog/compare/v0.12.0...v0.12.1
200207
[v0.12.0]: https://github.com/cucumber/godog/compare/v0.11.0...v0.12.0
201208
[v0.11.0]: https://github.com/cucumber/godog/compare/v0.10.0...v0.11.0

internal/builder/builder.go

+5-3
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,11 @@ func Build(bin string) error {
127127
// we also print back the temp WORK directory
128128
// go has built. We will reuse it for our suite workdir.
129129
temp := fmt.Sprintf(filepath.Join("%s", "temp-%d.test"), os.TempDir(), time.Now().UnixNano())
130-
modTidyOutput, err := exec.Command("go", "mod", "tidy").CombinedOutput()
131-
if err != nil {
132-
return fmt.Errorf("failed to tidy modules in tested package: %s, reason: %v, output: %s", abs, err, string(modTidyOutput))
130+
if os.Getenv("GO111MODULE") != "off" {
131+
modTidyOutput, err := exec.Command("go", "mod", "tidy").CombinedOutput()
132+
if err != nil {
133+
return fmt.Errorf("failed to tidy modules in tested package: %s, reason: %v, output: %s", abs, err, string(modTidyOutput))
134+
}
133135
}
134136
testOutput, err := exec.Command("go", "test", "-c", "-work", "-o", temp).CombinedOutput()
135137
if err != nil {

0 commit comments

Comments
 (0)