Skip to content

Commit a0ae5fa

Browse files
committed
gopls/internal/server: remove tempDir field
It wasn't used for anything! Fixes golang/go#74373 Change-Id: Ie867398d508f1094c633945ba5330cb32a2b6dbe Reviewed-on: https://go-review.googlesource.com/c/tools/+/683995 Reviewed-by: Robert Findley <[email protected]> Auto-Submit: Alan Donovan <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent 3b3fffa commit a0ae5fa

File tree

2 files changed

+0
-21
lines changed

2 files changed

+0
-21
lines changed

gopls/internal/server/general.go

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -54,20 +54,6 @@ func (s *server) Initialize(ctx context.Context, params *protocol.ParamInitializ
5454
s.state = serverInitializing
5555
s.stateMu.Unlock()
5656

57-
// For uniqueness, use the gopls PID rather than params.ProcessID (the client
58-
// pid). Some clients might start multiple gopls servers, though they
59-
// probably shouldn't.
60-
pid := os.Getpid()
61-
s.tempDir = filepath.Join(os.TempDir(), fmt.Sprintf("gopls-%d.%s", pid, s.session.ID()))
62-
err := os.Mkdir(s.tempDir, 0700)
63-
if err != nil {
64-
// MkdirTemp could fail due to permissions issues. This is a problem with
65-
// the user's environment, but should not block gopls otherwise behaving.
66-
// All usage of s.tempDir should be predicated on having a non-empty
67-
// s.tempDir.
68-
event.Error(ctx, "creating temp dir", err)
69-
s.tempDir = ""
70-
}
7157
s.progress.SetSupportsWorkDoneProgress(params.Capabilities.Window.WorkDoneProgress)
7258

7359
options := s.Options().Clone()
@@ -642,11 +628,6 @@ func (s *server) Shutdown(ctx context.Context) error {
642628
// drop all the active views
643629
s.session.Shutdown(ctx)
644630
s.state = serverShutDown
645-
if s.tempDir != "" {
646-
if err := os.RemoveAll(s.tempDir); err != nil {
647-
event.Error(ctx, "removing temp dir", err)
648-
}
649-
}
650631
}
651632
return nil
652633
}

gopls/internal/server/server.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ type server struct {
8686

8787
session *cache.Session
8888

89-
tempDir string
90-
9189
// changedFiles tracks files for which there has been a textDocument/didChange.
9290
changedFilesMu sync.Mutex
9391
changedFiles map[protocol.DocumentURI]unit

0 commit comments

Comments
 (0)