golang.org/x/tools/gopls@v0.15.3/internal/lsprpc/autostart_default.go (about) 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 "fmt" 9 "os/exec" 10 ) 11 12 var ( 13 daemonize = func(*exec.Cmd) {} 14 autoNetworkAddress = autoNetworkAddressDefault 15 verifyRemoteOwnership = verifyRemoteOwnershipDefault 16 ) 17 18 func runRemote(cmd *exec.Cmd) error { 19 daemonize(cmd) 20 if err := cmd.Start(); err != nil { 21 return fmt.Errorf("starting remote gopls: %w", err) 22 } 23 return nil 24 } 25 26 // autoNetworkAddressDefault returns the default network and address for the 27 // automatically-started gopls remote. See autostart_posix.go for more 28 // information. 29 func autoNetworkAddressDefault(goplsPath, id string) (network string, address string) { 30 if id != "" { 31 panic("identified remotes are not supported on windows") 32 } 33 return "tcp", "localhost:37374" 34 } 35 36 func verifyRemoteOwnershipDefault(network, address string) (bool, error) { 37 return true, nil 38 }