Skip to content

Commit 2b7b26d

Browse files
committed
internal/imports: add buildflags to ProcessEnv
This change adds a buildflags variable to the ProcessEnv inside internal/imports. When you run go list with GO111MODULE=on to get information about the package you are in, it will add a go directive to your go.mod file if there is not one. With the tempModfile=on flag, there should be no changes to a user's go.mod file. Updates golang/go#36247 Change-Id: I817e4c46b4f433d0665fcb7585fcdf4f87049a38 Reviewed-on: https://go-review.googlesource.com/c/tools/+/215978 Run-TryBot: Rohan Challa <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Heschi Kreinick <[email protected]>
1 parent 45e6918 commit 2b7b26d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

internal/lsp/cache/view.go

+6
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,12 @@ func (v *view) buildProcessEnv(ctx context.Context) (*imports.ProcessEnv, error)
373373
env.GOSUMDB = split[1]
374374
}
375375
}
376+
if len(cfg.BuildFlags) > 0 {
377+
if env.GOFLAGS != "" {
378+
env.GOFLAGS += " "
379+
}
380+
env.GOFLAGS += strings.Join(cfg.BuildFlags, " ")
381+
}
376382
return env, nil
377383
}
378384

0 commit comments

Comments
 (0)