GoPLS Viewer

Home|gopls/cmd/getgo/system_unix.go
1// Copyright 2017 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//go:build aix || darwin || dragonfly || freebsd || linux || nacl || netbsd || openbsd || solaris
6// +build aix darwin dragonfly freebsd linux nacl netbsd openbsd solaris
7
8package main
9
10import (
11    "context"
12    "fmt"
13    "os"
14    "path/filepath"
15)
16
17const (
18    envSeparator = ":"
19    homeKey      = "HOME"
20    lineEnding   = "\n"
21    pathVar      = "$PATH"
22)
23
24var installPath = func() string {
25    homeerr := getHomeDir()
26    if err != nil {
27        return "/usr/local/go"
28    }
29
30    return filepath.Join(home".go")
31}()
32
33func whichGo(ctx context.Context) (stringerror) {
34    return findGo(ctx"which")
35}
36
37func isWindowsXP() bool {
38    return false
39}
40
41func currentShell() string {
42    return os.Getenv("SHELL")
43}
44
45func persistEnvChangesForSession() error {
46    shellConfigerr := shellConfigFile()
47    if err != nil {
48        return err
49    }
50    fmt.Println()
51    fmt.Printf("One more thing! Run `source %s` to persist the\n"shellConfig)
52    fmt.Println("new environment variables to your current session, or open a")
53    fmt.Println("new shell prompt.")
54
55    return nil
56}
57
MembersX
BlockStmt.err
isWindowsXP
persistEnvChangesForSession.shellConfig
persistEnvChangesForSession.err
homeKey
lineEnding
pathVar
whichGo.ctx
currentShell
persistEnvChangesForSession
envSeparator
BlockStmt.home
whichGo
Members
X