internal/lsp/cmd: remove unused Env from pkgLoadConfig

Instead rely on the process env vars the `gopls vulncheck`
command runs with.

Change-Id: I313a035d9bb7dbbdf2199474e0864cdb591e15ab
Reviewed-on: https://go-review.googlesource.com/c/tools/+/420996
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Suzy Mueller <suzmue@golang.org>
Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Hana (Hyang-Ah) Kim 2022-08-02 23:24:30 -04:00 committed by Hyang-Ah Hana Kim
parent 6c27717f2a
commit 3519aa25b8
2 changed files with 1 additions and 16 deletions

View File

@ -27,10 +27,6 @@ type pkgLoadConfig struct {
// the build system's query tool.
BuildFlags []string
// Env is the environment to use when invoking the build system's query tool.
// If Env is nil, the current environment is used.
Env []string
// If Tests is set, the loader includes related test packages.
Tests bool
}
@ -65,11 +61,6 @@ func (v *vulncheck) Run(ctx context.Context, args ...string) error {
if len(args) == 1 {
pattern = args[0]
}
cwd, err := os.Getwd()
if err != nil {
return tool.CommandLineErrorf("failed to get current directory: %v", err)
}
var cfg pkgLoadConfig
if v.Config {
if err := json.NewDecoder(os.Stdin).Decode(&cfg); err != nil {
@ -87,8 +78,7 @@ func (v *vulncheck) Run(ctx context.Context, args ...string) error {
Context: ctx,
Tests: cfg.Tests,
BuildFlags: cfg.BuildFlags,
Env: cfg.Env,
Dir: cwd,
// inherit the current process's cwd and env.
}
res, err := opts.Hooks.Govulncheck(ctx, loadCfg, pattern)

View File

@ -797,11 +797,6 @@ type pkgLoadConfig struct {
// the build system's query tool.
BuildFlags []string
// Env is the environment to use when invoking the build system's query tool.
// If Env is nil, the current environment is used.
// TODO: This seems unnecessary. Delete.
Env []string
// If Tests is set, the loader includes related test packages.
Tests bool
}