Fix compilation for non-modules (#436)

Этот коммит содержится в:
Viacheslav Poturaev 2021-10-15 00:25:30 +07:00 коммит произвёл GitHub
родитель 239a42468a
коммит 86a56351ef
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 12 добавлений и 3 удалений

Просмотреть файл

@ -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] ## [v0.12.1]
### Fixed ### Fixed
@ -196,6 +202,7 @@ This document is formatted according to the principles of [Keep A CHANGELOG](htt
<!-- Releases --> <!-- 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.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.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 [v0.11.0]: https://github.com/cucumber/godog/compare/v0.10.0...v0.11.0

Просмотреть файл

@ -127,9 +127,11 @@ func Build(bin string) error {
// we also print back the temp WORK directory // we also print back the temp WORK directory
// go has built. We will reuse it for our suite workdir. // 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()) temp := fmt.Sprintf(filepath.Join("%s", "temp-%d.test"), os.TempDir(), time.Now().UnixNano())
modTidyOutput, err := exec.Command("go", "mod", "tidy").CombinedOutput() if os.Getenv("GO111MODULE") != "off" {
if err != nil { modTidyOutput, err := exec.Command("go", "mod", "tidy").CombinedOutput()
return fmt.Errorf("failed to tidy modules in tested package: %s, reason: %v, output: %s", abs, err, string(modTidyOutput)) 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() testOutput, err := exec.Command("go", "test", "-c", "-work", "-o", temp).CombinedOutput()
if err != nil { if err != nil {