mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-05 03:23:49 +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 }}
|
||||
goversion: "https://golang.org/dl/go1.16.linux-amd64.tar.gz"
|
||||
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/filepath"
|
||||
"runtime"
|
||||
"runtime/debug"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
@ -26,6 +27,13 @@ import (
|
||||
// Version go-cqhttp的版本信息,在编译时使用ldflags进行覆盖
|
||||
var Version = "unknown"
|
||||
|
||||
func init() {
|
||||
info, ok := debug.ReadBuildInfo()
|
||||
if ok {
|
||||
Version = info.Main.Version
|
||||
}
|
||||
}
|
||||
|
||||
// CQGetLoginInfo 获取登录号信息
|
||||
//
|
||||
// https://git.io/Jtz1I
|
||||
|
Loading…
x
Reference in New Issue
Block a user