...
1
2
3
4
5 package gover
6
7 import (
8 "internal/goversion"
9 "runtime"
10 "strconv"
11 )
12
13
14
15
16 var TestVersion string
17
18
19 func Local() string {
20 v, _ := local()
21 return v
22 }
23
24
25 func LocalToolchain() string {
26 _, t := local()
27 return t
28 }
29
30 func local() (goVers, toolVers string) {
31 toolVers = runtime.Version()
32 if TestVersion != "" {
33 toolVers = TestVersion
34 }
35 goVers = FromToolchain(toolVers)
36 if goVers == "" {
37
38 goVers = "1." + strconv.Itoa(goversion.Version)
39 toolVers = "go" + goVers
40 }
41 return goVers, toolVers
42 }
43
View as plain text