...
1
2
3
4
5
6
7
8 package plot
9
10 import (
11 "fmt"
12 "runtime/debug"
13 )
14
15 const root = "gonum.org/v1/plot"
16
17
18
19
20
21
22
23
24
25
26
27
28 func Version() (version, sum string) {
29 b, ok := debug.ReadBuildInfo()
30 if !ok {
31 return "", ""
32 }
33 for _, m := range b.Deps {
34 if m.Path == root {
35 if m.Replace != nil {
36 switch {
37 case m.Replace.Version != "" && m.Replace.Path != "":
38 return fmt.Sprintf("%s=>%s %s", m.Version, m.Replace.Path, m.Replace.Version), m.Replace.Sum
39 case m.Replace.Version != "":
40 return fmt.Sprintf("%s=>%s", m.Version, m.Replace.Version), m.Replace.Sum
41 case m.Replace.Path != "":
42 return fmt.Sprintf("%s=>%s", m.Version, m.Replace.Path), m.Replace.Sum
43 default:
44 return m.Version + "*", m.Sum + "*"
45 }
46 }
47 return m.Version, m.Sum
48 }
49 }
50 return "", ""
51 }
52
View as plain text