Skip to content

Commit f33d08f

Browse files
committed
imain: protect against GOMOD environment variable
Protect exectution against a GOMOD environment variable: the original Go module context (related to $PWD) from which goeval was started must always be ignored.
1 parent c2f41e1 commit f33d08f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

main.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,9 @@ func _main() error {
402402
env = append(env, "GOPROXY=off")
403403
}
404404

405+
// Do not let an inherited GOMOD variable go through.
406+
env = append(env, "GOMOD="+gomod)
407+
405408
cmd := exec.Command(goCmd, gogetArgs...)
406409
cmd.Env = env
407410
cmd.Dir = dir

0 commit comments

Comments
 (0)