Skip to content

Commit 3519aa2

Browse files
committed
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 <[email protected]> Reviewed-by: Suzy Mueller <[email protected]> Run-TryBot: Hyang-Ah Hana Kim <[email protected]> Reviewed-by: Robert Findley <[email protected]> gopls-CI: kokoro <[email protected]>
1 parent 6c27717 commit 3519aa2

File tree

2 files changed

+1
-16
lines changed

2 files changed

+1
-16
lines changed

internal/lsp/cmd/vulncheck.go

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ type pkgLoadConfig struct {
2727
// the build system's query tool.
2828
BuildFlags []string
2929

30-
// Env is the environment to use when invoking the build system's query tool.
31-
// If Env is nil, the current environment is used.
32-
Env []string
33-
3430
// If Tests is set, the loader includes related test packages.
3531
Tests bool
3632
}
@@ -65,11 +61,6 @@ func (v *vulncheck) Run(ctx context.Context, args ...string) error {
6561
if len(args) == 1 {
6662
pattern = args[0]
6763
}
68-
69-
cwd, err := os.Getwd()
70-
if err != nil {
71-
return tool.CommandLineErrorf("failed to get current directory: %v", err)
72-
}
7364
var cfg pkgLoadConfig
7465
if v.Config {
7566
if err := json.NewDecoder(os.Stdin).Decode(&cfg); err != nil {
@@ -87,8 +78,7 @@ func (v *vulncheck) Run(ctx context.Context, args ...string) error {
8778
Context: ctx,
8879
Tests: cfg.Tests,
8980
BuildFlags: cfg.BuildFlags,
90-
Env: cfg.Env,
91-
Dir: cwd,
81+
// inherit the current process's cwd and env.
9282
}
9383

9484
res, err := opts.Hooks.Govulncheck(ctx, loadCfg, pattern)

internal/lsp/command.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -797,11 +797,6 @@ type pkgLoadConfig struct {
797797
// the build system's query tool.
798798
BuildFlags []string
799799

800-
// Env is the environment to use when invoking the build system's query tool.
801-
// If Env is nil, the current environment is used.
802-
// TODO: This seems unnecessary. Delete.
803-
Env []string
804-
805800
// If Tests is set, the loader includes related test packages.
806801
Tests bool
807802
}

0 commit comments

Comments
 (0)