Skip to content

Commit 7a03feb

Browse files
adonovangopherbot
authored andcommitted
gopls/internal/lsp/cmd: remove vestiges of debugging golang/go#59475
Updates golang/go#59475 Change-Id: Ib775deeff902e2eba4a99fb970374063897da7df Reviewed-on: https://go-review.googlesource.com/c/tools/+/497396 Auto-Submit: Alan Donovan <adonovan@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com> Run-TryBot: Alan Donovan <adonovan@google.com>
1 parent a70f2bc commit 7a03feb

File tree

3 files changed

+1
-21
lines changed

3 files changed

+1
-21
lines changed

gopls/internal/lsp/cmd/cmd.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -518,11 +518,6 @@ func (c *cmdClient) ApplyEdit(ctx context.Context, p *protocol.ApplyWorkspaceEdi
518518
}
519519

520520
func (c *cmdClient) PublishDiagnostics(ctx context.Context, p *protocol.PublishDiagnosticsParams) error {
521-
var debug = os.Getenv(DebugSuggestedFixEnvVar) == "true"
522-
if debug {
523-
log.Printf("PublishDiagnostics URI=%v Diagnostics=%v", p.URI, p.Diagnostics)
524-
}
525-
526521
if p.URI == "gopls://diagnostics-done" {
527522
close(c.diagnosticsDone)
528523
}

gopls/internal/lsp/cmd/suggested_fix.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"flag"
1010
"fmt"
1111
"io/ioutil"
12-
"log"
1312
"os"
1413

1514
"golang.org/x/tools/gopls/internal/lsp/protocol"
@@ -42,16 +41,11 @@ fix-flags:
4241
printFlagDefaults(f)
4342
}
4443

45-
const DebugSuggestedFixEnvVar = "_DEBUG_SUGGESTED_FIX"
46-
4744
// Run performs diagnostic checks on the file specified and either;
4845
// - if -w is specified, updates the file in place;
4946
// - if -d is specified, prints out unified diffs of the changes; or
5047
// - otherwise, prints the new versions to stdout.
5148
func (s *suggestedFix) Run(ctx context.Context, args ...string) error {
52-
// For debugging golang/go#59475, enable some additional output.
53-
var debug = os.Getenv(DebugSuggestedFixEnvVar) == "true"
54-
5549
if len(args) < 1 {
5650
return tool.CommandLineErrorf("fix expects at least 1 argument")
5751
}
@@ -80,9 +74,6 @@ func (s *suggestedFix) Run(ctx context.Context, args ...string) error {
8074
conn.Client.filesMu.Lock()
8175
diagnostics = append(diagnostics, file.diagnostics...)
8276
conn.Client.filesMu.Unlock()
83-
if debug {
84-
log.Printf("file diagnostics: %#v", diagnostics)
85-
}
8677

8778
// Request code actions
8879
codeActionKinds := []protocol.CodeActionKind{protocol.QuickFix}
@@ -106,9 +97,6 @@ func (s *suggestedFix) Run(ctx context.Context, args ...string) error {
10697
if err != nil {
10798
return fmt.Errorf("%v: %v", from, err)
10899
}
109-
if debug {
110-
log.Printf("code actions: %#v", actions)
111-
}
112100

113101
// Gather edits from matching code actions.
114102
var edits []protocol.TextEdit

gopls/internal/lsp/cmd/test/integration_test.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -890,10 +890,7 @@ func goplsWithEnv(t *testing.T, dir string, env []string, args ...string) *resul
890890
}
891891

892892
goplsCmd := exec.Command(os.Args[0], args...)
893-
goplsCmd.Env = append(os.Environ(),
894-
"ENTRYPOINT=goplsMain",
895-
fmt.Sprintf("%s=true", cmd.DebugSuggestedFixEnvVar),
896-
)
893+
goplsCmd.Env = append(os.Environ(), "ENTRYPOINT=goplsMain")
897894
goplsCmd.Env = append(goplsCmd.Env, env...)
898895
goplsCmd.Dir = dir
899896
goplsCmd.Stdout = new(bytes.Buffer)

0 commit comments

Comments
 (0)