From 41e19269e2e83f48161b8b80ed5aa2cb22f8a558 Mon Sep 17 00:00:00 2001 From: lifei6671 Date: Tue, 30 May 2017 20:46:00 +0800 Subject: [PATCH] * --- appveyor.yml | 9 ++++++++- commands/install.go | 7 +++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 70e80bec..7d008a58 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -10,10 +10,12 @@ environment: - tbs_arch: "x86" tbs_tools: "mingw" tbs_static_runtime: 1 + GOARCH: 386 - tbs_arch: "x64" tbs_tools: "mingw" tbs_static_runtime: 1 + GOARCH: amd64 build: false deploy: true @@ -39,8 +41,13 @@ install: - go env - go get -d ./... +build_script: + - if [%tbs_tools%]==[mingw] if [%tbs_arch%]==[x86] SET PATH=C:\mingw32\bin;%PATH% + - if [%tbs_tools%]==[mingw] if [%tbs_arch%]==[x64] SET PATH=C:\mingw64\bin;%PATH% + - go build -v -o "godoc_windows_%GOARCH%.exe" -ldflags="-w -X github.com/lifei6671/godoc/conf.VERSION=%APPVEYOR_REPO_TAG_NAME% -X 'github.com/lifei6671/godoc/conf.BUILD_TIME=`date`' -X 'conf.GO_VERSION=`github.com/lifei6671/godoc/go version`'" + test_script: - - go build -x -v -tags "pam" -ldflags "-w" + - godoc_windows_%GOARCH%.exe version notifications: - provider: Email diff --git a/commands/install.go b/commands/install.go index 337598b0..16958bd8 100644 --- a/commands/install.go +++ b/commands/install.go @@ -28,6 +28,13 @@ func Install() { } } +func Version() { + if len(os.Args) >= 2 && os.Args[1] == "version" { + fmt.Println(conf.VERSION) + os.Exit(0) + } +} + //初始化数据 func initialization() {