Skip to content

Commit a1a928d

Browse files
adonovangopherbot
authored andcommitted
gopls: remove dead code
This change removes functions reported as unreachable by internal/cmd/deadcode. Also, move the "generated" file marker to the correct positions. Change-Id: I56f3c056cd010914ac5d4e410f1ee4a44289cc77 Reviewed-on: https://go-review.googlesource.com/c/tools/+/524760 Run-TryBot: Alan Donovan <adonovan@google.com> Reviewed-by: Robert Findley <rfindley@google.com> Auto-Submit: Alan Donovan <adonovan@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
1 parent 7663a40 commit a1a928d

File tree

5 files changed

+4
-53
lines changed

5 files changed

+4
-53
lines changed

gopls/internal/lsp/cmd/cmd.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -348,15 +348,6 @@ func (app *Application) connect(ctx context.Context, onProgress func(*protocol.P
348348
}
349349
}
350350

351-
// CloseTestConnections terminates shared connections used in command tests. It
352-
// should only be called from tests.
353-
func CloseTestConnections(ctx context.Context) {
354-
for _, c := range internalConnections {
355-
c.Shutdown(ctx)
356-
c.Exit(ctx)
357-
}
358-
}
359-
360351
func (app *Application) connectRemote(ctx context.Context, remote string) (*connection, error) {
361352
conn, err := lsprpc.ConnectToRemote(ctx, remote)
362353
if err != nil {

gopls/internal/lsp/command/command_gen.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gopls/internal/lsp/command/gen/gen.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gopls/internal/lsp/source/options.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,14 +1311,6 @@ func (e *SoftError) Error() string {
13111311
return e.msg
13121312
}
13131313

1314-
// softErrorf reports an error that does not affect the functionality of gopls
1315-
// (a warning in the UI).
1316-
// The formatted message will be shown to the user unmodified.
1317-
func (r *OptionResult) softErrorf(format string, values ...interface{}) {
1318-
msg := fmt.Sprintf(format, values...)
1319-
r.Error = &SoftError{msg}
1320-
}
1321-
13221314
// deprecated reports the current setting as deprecated. If 'replacement' is
13231315
// non-nil, it is suggested to the user.
13241316
func (r *OptionResult) deprecated(replacement string) {

gopls/internal/lsp/tests/tests.go

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,38 +1159,6 @@ func SpanName(spn span.Span) string {
11591159
return fmt.Sprintf("%v_%v_%v", uriName(spn.URI()), spn.Start().Line(), spn.Start().Column())
11601160
}
11611161

1162-
func CopyFolderToTempDir(folder string) (string, error) {
1163-
if _, err := os.Stat(folder); err != nil {
1164-
return "", err
1165-
}
1166-
dst, err := ioutil.TempDir("", "modfile_test")
1167-
if err != nil {
1168-
return "", err
1169-
}
1170-
fds, err := ioutil.ReadDir(folder)
1171-
if err != nil {
1172-
return "", err
1173-
}
1174-
for _, fd := range fds {
1175-
srcfp := filepath.Join(folder, fd.Name())
1176-
stat, err := os.Stat(srcfp)
1177-
if err != nil {
1178-
return "", err
1179-
}
1180-
if !stat.Mode().IsRegular() {
1181-
return "", fmt.Errorf("cannot copy non regular file %s", srcfp)
1182-
}
1183-
contents, err := ioutil.ReadFile(srcfp)
1184-
if err != nil {
1185-
return "", err
1186-
}
1187-
if err := ioutil.WriteFile(filepath.Join(dst, fd.Name()), contents, stat.Mode()); err != nil {
1188-
return "", err
1189-
}
1190-
}
1191-
return dst, nil
1192-
}
1193-
11941162
func shouldSkip(data *Data, uri span.URI) bool {
11951163
if data.ModfileFlagAvailable {
11961164
return false

0 commit comments

Comments
 (0)