1
0
mirror of https://github.com/golang/go synced 2024-11-18 13:24:39 -07:00
go/internal/lsp/lsprpc/autostart_default.go
Rob Findley df83f4e7c1 internal/lsp: fix builds and tests for go1.12+
Seems we've drifted a bit from go1.12 support, mostly due to error
wrapping.

Fix this, as well as some assorted other failures.

I haven't tested 1.12 interactively.

For golang/go#39146

Change-Id: Id347ead2a13e89b76d2ae0047750e6b6b49911eb
Reviewed-on: https://go-review.googlesource.com/c/tools/+/250941
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2020-08-27 14:30:46 +00:00

40 lines
1.0 KiB
Go

// Copyright 2020 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package lsprpc
import (
"os/exec"
errors "golang.org/x/xerrors"
)
var (
startRemote = startRemoteDefault
autoNetworkAddress = autoNetworkAddressDefault
verifyRemoteOwnership = verifyRemoteOwnershipDefault
)
func startRemoteDefault(goplsPath string, args ...string) error {
cmd := exec.Command(goplsPath, args...)
if err := cmd.Start(); err != nil {
return errors.Errorf("starting remote gopls: %w", err)
}
return nil
}
// autoNetworkAddress returns the default network and address for the
// automatically-started gopls remote. See autostart_posix.go for more
// information.
func autoNetworkAddressDefault(goplsPath, id string) (network string, address string) {
if id != "" {
panic("identified remotes are not supported on windows")
}
return "tcp", "localhost:37374"
}
func verifyRemoteOwnershipDefault(network, address string) (bool, error) {
return true, nil
}