File: autostart_default.go

package info (click to toggle)
golang-github-cue-lang-cue 0.12.0.-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 19,072 kB
  • sloc: sh: 57; makefile: 17
file content (38 lines) | stat: -rw-r--r-- 987 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// 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 (
	"fmt"
	"os/exec"
)

var (
	daemonize             = func(*exec.Cmd) {}
	autoNetworkAddress    = autoNetworkAddressDefault
	verifyRemoteOwnership = verifyRemoteOwnershipDefault
)

func runRemote(cmd *exec.Cmd) error {
	daemonize(cmd)
	if err := cmd.Start(); err != nil {
		return fmt.Errorf("starting remote gopls: %w", err)
	}
	return nil
}

// autoNetworkAddressDefault 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
}