mirror of
https://github.com/golang/go
synced 2024-11-18 19:24:39 -07:00
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 <rohan@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Heschi Kreinick <heschi@google.com>
This commit is contained in:
parent
45e69182d1
commit
2b7b26d7b0
6
internal/lsp/cache/view.go
vendored
6
internal/lsp/cache/view.go
vendored
@ -373,6 +373,12 @@ func (v *view) buildProcessEnv(ctx context.Context) (*imports.ProcessEnv, error)
|
||||
env.GOSUMDB = split[1]
|
||||
}
|
||||
}
|
||||
if len(cfg.BuildFlags) > 0 {
|
||||
if env.GOFLAGS != "" {
|
||||
env.GOFLAGS += " "
|
||||
}
|
||||
env.GOFLAGS += strings.Join(cfg.BuildFlags, " ")
|
||||
}
|
||||
return env, nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user