mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-05 11:33:48 +08:00
another way to get version
This commit is contained in:
parent
03c3af14aa
commit
e98e4eef8c
3
.github/workflows/release.yml
vendored
3
.github/workflows/release.yml
vendored
@ -32,5 +32,4 @@ jobs:
|
|||||||
goarch: ${{ matrix.goarch }}
|
goarch: ${{ matrix.goarch }}
|
||||||
goversion: "https://golang.org/dl/go1.16.linux-amd64.tar.gz"
|
goversion: "https://golang.org/dl/go1.16.linux-amd64.tar.gz"
|
||||||
build_flags: -trimpath
|
build_flags: -trimpath
|
||||||
ldflags: -w -s -X "github.com/Mrs4s/go-cqhttp/coolq.Version=${{ env.RELEASE_VERSION }}"
|
ldflags: -w -s
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ import (
|
|||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"runtime/debug"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
@ -26,6 +27,13 @@ import (
|
|||||||
// Version go-cqhttp的版本信息,在编译时使用ldflags进行覆盖
|
// Version go-cqhttp的版本信息,在编译时使用ldflags进行覆盖
|
||||||
var Version = "unknown"
|
var Version = "unknown"
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
info, ok := debug.ReadBuildInfo()
|
||||||
|
if ok {
|
||||||
|
Version = info.Main.Version
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// CQGetLoginInfo 获取登录号信息
|
// CQGetLoginInfo 获取登录号信息
|
||||||
//
|
//
|
||||||
// https://git.io/Jtz1I
|
// https://git.io/Jtz1I
|
||||||
|
Loading…
x
Reference in New Issue
Block a user