Этот коммит содержится в:
Viacheslav Poturaev 2022-03-26 10:16:17 +01:00 коммит произвёл GitHub
родитель 5efecbaf10
коммит 6f877d6b03
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 29 добавлений и 0 удалений

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

@ -15,6 +15,10 @@ This document is formatted according to the principles of [Keep A CHANGELOG](htt
- Changed underlying cobra command setup to return errors instead of calling `os.Exit` directly to enable simpler testing. ([454](https://github.com/cucumber/godog/pull/454) - [mxygem]) - Changed underlying cobra command setup to return errors instead of calling `os.Exit` directly to enable simpler testing. ([454](https://github.com/cucumber/godog/pull/454) - [mxygem])
- Remove use of deprecated methods from `_examples`. ([460](https://github.com/cucumber/godog/pull/460) - [ricardogarfe]) - Remove use of deprecated methods from `_examples`. ([460](https://github.com/cucumber/godog/pull/460) - [ricardogarfe])
### Fixed
- Support for go1.18 in `godog` cli mode ([466](https://github.com/cucumber/godog/pull/466) - [vearutop])
## [v0.12.4] ## [v0.12.4]
### Added ### Added

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

@ -205,6 +205,10 @@ func Build(bin string) error {
"-complete", "-complete",
} }
if err := filterImportCfg(compilerCfg); err != nil {
return err
}
args = append(args, "-pack", testmain) args = append(args, "-pack", testmain)
cmd := exec.Command(compiler, args...) cmd := exec.Command(compiler, args...)
cmd.Env = os.Environ() cmd.Env = os.Environ()
@ -234,6 +238,27 @@ func Build(bin string) error {
return nil return nil
} }
// filterImportCfg strips unsupported lines from imports configuration.
func filterImportCfg(path string) error {
orig, err := os.ReadFile(path)
if err != nil {
return fmt.Errorf("failed to read %s: %w", path, err)
}
res := ""
for _, l := range strings.Split(string(orig), "\n") {
if !strings.HasPrefix(l, "modinfo") {
res += l + "\n"
}
}
err = ioutil.WriteFile(path, []byte(res), 0600)
if err != nil {
return fmt.Errorf("failed to write %s: %w", path, err)
}
return nil
}
func maybeVendoredGodog() *build.Package { func maybeVendoredGodog() *build.Package {
dir, err := filepath.Abs(".") dir, err := filepath.Abs(".")
if err != nil { if err != nil {