update version

This commit is contained in:
shoopea 2021-10-27 09:44:55 +08:00
parent b9d7dd58bc
commit 366b878f20
7 changed files with 179 additions and 45 deletions

File diff suppressed because one or more lines are too long

3
generate.go Normal file
View File

@ -0,0 +1,3 @@
package main
//go:generate bash ./version.sh

1
go.mod
View File

@ -3,6 +3,7 @@ module git.siteop.biz/chtwrs/chirpnest
go 1.16
require (
github.com/go-bindata/go-bindata v3.1.2+incompatible // indirect
github.com/go-sql-driver/mysql v1.5.0
github.com/jinzhu/copier v0.2.8
github.com/robfig/cron/v3 v3.0.1

2
go.sum
View File

@ -1,5 +1,7 @@
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/go-bindata/go-bindata v3.1.2+incompatible h1:5vjJMVhowQdPzjE1LdxyFF7YFTXg5IgGVW4gBr5IbvE=
github.com/go-bindata/go-bindata v3.1.2+incompatible/go.mod h1:xK8Dsgwmeed+BBsSy2XTopBn/8uK2HWuGSnA11C3Joo=
github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs=
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/jinzhu/copier v0.2.8 h1:N8MbL5niMwE3P4dOwurJixz5rMkKfujmMRFmAanSzWE=

View File

@ -21,11 +21,8 @@ import (
)
var (
config = flag.String("config", "./data/config.json", "config file path")
initdb = flag.Bool("initdb", false, "initialize bot database")
githash string
buildstamp string
commits string
config = flag.String("config", "./data/config.json", "config file path")
initdb = flag.Bool("initdb", false, "initialize bot database")
db *sql.DB
bot *tb.Bot

5
version.go Normal file
View File

@ -0,0 +1,5 @@
// Code generated by version.sh (@generated) DO NOT EDIT.
package main
var githash = "b9d7dd5"
var buildstamp = "2021-10-27_01:44:14"
var commits = "2551"

12
version.sh Normal file
View File

@ -0,0 +1,12 @@
# Get the version.
githash=`git rev-parse --short HEAD`
buildstamp=`date -u '+%Y-%m-%d_%H:%M:%S'`
commits=`git rev-list --count master`
# Write out the package.
cat << EOF > version.go
// Code generated by version.sh (@generated) DO NOT EDIT.
package main
var githash = "$githash"
var buildstamp = "$buildstamp"
var commits = "$commits"
EOF