Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / golang.org / x / tools@v0.0.0-20201105173854-bc9fc8d8c4bc / internal / lsp / lsprpc / autostart_default.go
1 // Copyright 2020 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 package lsprpc
6
7 import (
8         "os/exec"
9
10         errors "golang.org/x/xerrors"
11 )
12
13 var (
14         startRemote           = startRemoteDefault
15         autoNetworkAddress    = autoNetworkAddressDefault
16         verifyRemoteOwnership = verifyRemoteOwnershipDefault
17 )
18
19 func startRemoteDefault(goplsPath string, args ...string) error {
20         cmd := exec.Command(goplsPath, args...)
21         if err := cmd.Start(); err != nil {
22                 return errors.Errorf("starting remote gopls: %w", err)
23         }
24         return nil
25 }
26
27 // autoNetworkAddress returns the default network and address for the
28 // automatically-started gopls remote. See autostart_posix.go for more
29 // information.
30 func autoNetworkAddressDefault(goplsPath, id string) (network string, address string) {
31         if id != "" {
32                 panic("identified remotes are not supported on windows")
33         }
34         return "tcp", "localhost:37374"
35 }
36
37 func verifyRemoteOwnershipDefault(network, address string) (bool, error) {
38         return true, nil
39 }