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>
diff --git a/internal/lsp/cmd/vulncheck.go b/internal/lsp/cmd/vulncheck.go
index 19b3466..d5b05a9 100644
--- a/internal/lsp/cmd/vulncheck.go
+++ b/internal/lsp/cmd/vulncheck.go
@@ -27,10 +27,6 @@
 	// 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 @@
 	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 @@
 		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)
diff --git a/internal/lsp/command.go b/internal/lsp/command.go
index 6df909b..f830a97 100644
--- a/internal/lsp/command.go
+++ b/internal/lsp/command.go
@@ -797,11 +797,6 @@
 	// 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
 }