-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmeta.go
More file actions
62 lines (54 loc) · 1.11 KB
/
meta.go
File metadata and controls
62 lines (54 loc) · 1.11 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
package main
import (
_ "embed"
"runtime/debug"
"strings"
)
var Version string = "devel"
var (
Revision string = "unknown"
ReleaseDate string = "unknown"
DirtyBuild bool
)
func init() {
info, ok := debug.ReadBuildInfo()
if !ok {
return
}
if Version == "devel" && info.Main.Version != "" && info.Main.Version != "(devel)" {
Version = info.Main.Version
}
for _, kv := range info.Settings {
switch kv.Key {
case "vcs.revision":
Revision = kv.Value
case "vcs.time":
ReleaseDate = kv.Value
case "vcs.modified":
if kv.Value == "true" {
DirtyBuild = true
} else if kv.Value == "false" {
DirtyBuild = false
} else {
panic("unexpected vcs.modified value")
}
}
}
}
//go:generate go run monks.co/run/cmd/licenses CREDITS.txt
//go:embed CREDITS.txt
var Credits string
//go:embed LICENSE.md
var License string
//go:embed CONTRIBUTORS.md
var contributors string
var Contributors string
func init() {
var b strings.Builder
for line := range strings.SplitSeq(contributors, "\n") {
if strings.HasPrefix(line, "- ") {
b.WriteString(line + "\n")
}
}
Contributors = b.String()
}