-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmisc.go
40 lines (36 loc) · 840 Bytes
/
misc.go
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
package main
import (
"log/slog"
"mime"
"runtime/debug"
)
const (
NoError = iota
UnknownError
OwnerNotFound
RepoNotFound
TagNameRequired
TokenNotFound
AssetDirNotFound
ErrorCreateRequest
ErrorBadPattern
AssetReadError
AssetUploadError
)
func init() {
// feels silly to have to do this
mime.AddExtensionType(".exe", "application/octet-stream")
mime.AddExtensionType(".zip", "application/zip")
mime.AddExtensionType(".tar.gz", "application/gzip")
mime.AddExtensionType(".txt", "text/plain")
}
func version() {
// seems like a nice place to sneak in some debug information
info, ok := debug.ReadBuildInfo()
if ok {
slog.Info("build info", "main", info.Main.Path, "version", info.Main.Version)
for _, setting := range info.Settings {
slog.Info("build info", "key", setting.Key, "value", setting.Value)
}
}
}