Skip to content

Commit bf43aba

Browse files
committed
support godog package in vendor directory
1 parent f9f6c20 commit bf43aba

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

builder_go110.go

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ func Build(bin string) error {
129129

130130
// make sure godog package archive is installed, gherkin
131131
// will be installed as dependency of godog
132-
cmd := exec.Command("go", "install", godogPkg.ImportPath)
132+
cmd := exec.Command("go", "install", "-i", godogPkg.ImportPath)
133133
cmd.Env = os.Environ()
134134
out, err := cmd.CombinedOutput()
135135
if err != nil {
@@ -196,6 +196,26 @@ func Build(bin string) error {
196196
cmd = exec.Command(linker, args...)
197197
cmd.Env = os.Environ()
198198

199+
// in case if build is without contexts, need to remove import maps
200+
if testdir == workdir {
201+
data, err := ioutil.ReadFile(cfg)
202+
if err != nil {
203+
return err
204+
}
205+
206+
lines := strings.Split(string(data), "\n")
207+
var fixed []string
208+
for _, line := range lines {
209+
if strings.Index(line, "importmap") == 0 {
210+
continue
211+
}
212+
fixed = append(fixed, line)
213+
}
214+
if err := ioutil.WriteFile(cfg, []byte(strings.Join(fixed, "\n")), 0600); err != nil {
215+
return err
216+
}
217+
}
218+
199219
out, err = cmd.CombinedOutput()
200220
if err != nil {
201221
msg := `failed to link test executable:

0 commit comments

Comments
 (0)