Fix support for go1.18 (#466)
Этот коммит содержится в:
родитель
5efecbaf10
коммит
6f877d6b03
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])
|
||||
- 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]
|
||||
|
||||
### Added
|
||||
|
|
|
@ -205,6 +205,10 @@ func Build(bin string) error {
|
|||
"-complete",
|
||||
}
|
||||
|
||||
if err := filterImportCfg(compilerCfg); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
args = append(args, "-pack", testmain)
|
||||
cmd := exec.Command(compiler, args...)
|
||||
cmd.Env = os.Environ()
|
||||
|
@ -234,6 +238,27 @@ func Build(bin string) error {
|
|||
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 {
|
||||
dir, err := filepath.Abs(".")
|
||||
if err != nil {
|
||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче