GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — dev/version/info.go at master · bool64/dev Expand file tree/ Copy pathinfo.goMore file actions 95 lines (78 loc) · 2.03 KB / Copy pathinfo.goFile metadata and controls95 lines (78 loc) · 2.03 KB 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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 // Package version contains build information. package version import "runtime" // Build information. Populated at build-time. // nolint:gochecknoglobals var ( version = "dev" revision string branch string buildUser string buildDate string dependencies map[string]string main string ) // Information holds app version info. type Information struct { Version string `json:"version,omitempty"` Revision string `json:"revision,omitempty"` Branch string `json:"branch,omitempty"` BuildUser string `json:"build_user,omitempty"` BuildDate string `json:"build_date,omitempty"` GoVersion string `json:"go_version,omitempty"` Dependencies map[string]string `json:"dependencies,omitempty"` } // Info returns app version info. func Info() Information { return Information{ Version: version, Revision: revision, Branch: branch, BuildUser: buildUser, BuildDate: buildDate, GoVersion: runtime.Version(), Dependencies: dependencies, } } // Module returns module version info. func Module(path string) Information { info := Info() if main == path { return info } ver := dependencies[path] info.Version = ver return info } // String return version information as string. func (i Information) String() string { res := "" if i.Version != "" { res += ", Version: " + i.Version } if i.Revision != "" { res += ", Revision: " + i.Revision } if i.Branch != "" { res += ", Branch: " + i.Branch } if i.BuildUser != "" { res += ", BuildUser: " + i.BuildUser } if i.BuildDate != "" { res += ", BuildDate: " + i.BuildDate } res += ", GoVersion: " + runtime.Version() return res[2:] } // Values return version information as string map. func (i Information) Values() map[string]string { return map[string]string{ "version": i.Version, "revision": i.Revision, "branch": i.Branch, "build_user": i.BuildUser, "build_date": i.BuildDate, "go_version": i.GoVersion, } } |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |