File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212 buildUser string
1313 buildDate string
1414 dependencies map [string ]string
15+ main string
1516)
1617
1718// Information holds app version info.
@@ -38,6 +39,20 @@ func Info() Information {
3839 }
3940}
4041
42+ // Module returns module version info.
43+ func Module (path string ) Information {
44+ info := Info ()
45+
46+ if main == path {
47+ return info
48+ }
49+
50+ ver := dependencies [path ]
51+ info .Version = ver
52+
53+ return info
54+ }
55+
4156// String return version information as string.
4257func (i Information ) String () string {
4358 res := ""
Original file line number Diff line number Diff line change @@ -18,6 +18,8 @@ func init() {
1818 buildDate = "(unknown)"
1919 }
2020
21+ main = info .Main .Path
22+
2123 dependencies = make (map [string ]string , len (info .Deps ))
2224 for _ , dep := range info .Deps {
2325 dependencies [dep .Path ] = dep .Version
You can’t perform that action at this time.
0 commit comments