diff options
author | Emile <git@emile.space> | 2024-10-25 15:55:50 +0200 |
---|---|---|
committer | Emile <git@emile.space> | 2024-10-25 15:55:50 +0200 |
commit | c90f36e3dd179d2de96f4f5fe38d8dc9a9de6dfe (patch) | |
tree | 89e9afb41c5bf76f48cfb09305a2d3db8d302b06 /vendor/maunium.net/go/mautrix/version.go | |
parent | 98bbb0f559a8883bc47bae80607dbe326a448e61 (diff) |
Diffstat (limited to 'vendor/maunium.net/go/mautrix/version.go')
-rw-r--r-- | vendor/maunium.net/go/mautrix/version.go | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/vendor/maunium.net/go/mautrix/version.go b/vendor/maunium.net/go/mautrix/version.go new file mode 100644 index 0000000..2936857 --- /dev/null +++ b/vendor/maunium.net/go/mautrix/version.go @@ -0,0 +1,31 @@ +package mautrix + +import ( + "fmt" + "regexp" + "runtime" + "strings" +) + +const Version = "v0.21.1" + +var GoModVersion = "" +var Commit = "" +var VersionWithCommit = Version + +var DefaultUserAgent = "mautrix-go/" + Version + " go/" + strings.TrimPrefix(runtime.Version(), "go") + +var goModVersionRegex = regexp.MustCompile(`v.+\d{14}-([0-9a-f]{12})`) + +func init() { + if GoModVersion != "" { + match := goModVersionRegex.FindStringSubmatch(GoModVersion) + if match != nil { + Commit = match[1] + } + } + if Commit != "" { + VersionWithCommit = fmt.Sprintf("%s+dev.%s", Version, Commit[:8]) + DefaultUserAgent = strings.Replace(DefaultUserAgent, "mautrix-go/"+Version, "mautrix-go/"+VersionWithCommit, 1) + } +} |