blob: 7dbfac9242f5bba4898c792deab6047db7267a1f (
plain)
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
|
package fhelp
import (
"os"
"go.wit.com/log"
)
/*
try to determine the GO working dir
this will look for a go.work file, otherwise
it will default to ~/go/src
returns:
string # ~/go/src or the path to the go.work file
bool # true if the user is using a go.work file
err # if everything goes wrong, the error
*/
func DetermineGoPath() (string, bool, error) {
gosrc := os.Getenv("FORGE_GOSRC")
if gosrc != "" {
hasWork := goWorkExists(gosrc)
log.Info("Using ENV{FORGE_GOSRC} =", gosrc)
return gosrc, hasWork, nil
}
gosrc, err := findGoSrc()
if err != nil {
log.Info("fhelp.DetermineGoPath()", err)
}
hasWork := goWorkExists(gosrc)
return gosrc, hasWork, err
}
|