change app name

This commit is contained in:
busyfree 2021-05-17 17:43:07 +08:00 committed by 小张
parent af82630e2b
commit 83d4d8cd4f
3 changed files with 24 additions and 2 deletions

View File

@ -5,7 +5,7 @@ VERSION_MASTER=master
COMMIT=`git rev-parse --short HEAD`
BUILDDATE=`date "+%Y-%m-%d/%H:%M:%S"`
BUILD_DIR=build
APP_NAME=go_fastdfs
APP_NAME=fileserver
sources=$(wildcard *.go)
build = GOOS=$(1) GOARCH=$(2) go build -o ${BUILD_DIR}/$(APP_NAME)-$(1)-$(2) -ldflags "-w -s -X 'main.VERSION=${VERSION}' -X 'main.GO_VERSION=${GO_VERSION}' -X 'main.GIT_VERSION=${COMMIT}' -X 'main.BUILD_TIME=${BUILDDATE}'" main.go

22
build.sh Normal file
View File

@ -0,0 +1,22 @@
#!/bin/bash
BIN_VERSION="go-fastdfs:${1-$(git describe --tags `git rev-parse HEAD`)}"
if [[ ! -d src ]];then
cp -r vendor src
fi
#for linux
GOPATH=`pwd` GOOS=linux GOARCH=amd64 go build -o fileserver -ldflags "-w -s -X 'main.VERSION=$BIN_VERSION' -X 'main.BUILD_TIME=build_time:`date`' -X 'main.GO_VERSION=`go version`' -X 'main.GIT_VERSION=git_version:`git rev-parse HEAD`'" main.go
GOPATH=`pwd` GOOS=linux GOARCH=386 go build -o fileserver32 -ldflags "-w -s -X 'main.VERSION=$BIN_VERSION' -X 'main.BUILD_TIME=build_time:`date`' -X 'main.GO_VERSION=`go version`' -X 'main.GIT_VERSION=git_version:`git rev-parse HEAD`'" main.go
#for windows
GOPATH=`pwd` GOOS=windows GOARCH=amd64 go build -o fileserver.exe -ldflags "-w -s -X 'main.VERSION=$BIN_VERSION' -X 'main.BUILD_TIME=build_time:`date`' -X 'main.GO_VERSION=`go version`' -X 'main.GIT_VERSION=git_version:`git rev-parse HEAD`'" main.go
GOPATH=`pwd` GOOS=windows GOARCH=386 go build -o fileserver32.exe -ldflags "-w -s -X 'main.VERSION=$BIN_VERSION' -X 'main.BUILD_TIME=build_time:`date`' -X 'main.GO_VERSION=`go version`' -X 'main.GIT_VERSION=git_version:`git rev-parse HEAD`'" main.go
#for mac
GOPATH=`pwd` GOOS=darwin GOARCH=amd64 go build -o fileserver_darwin -ldflags "-w -s -X 'main.VERSION=$BIN_VERSION' -X 'main.BUILD_TIME=build_time:`date`' -X 'main.GO_VERSION=`go version`' -X 'main.GIT_VERSION=git_version:`git rev-parse HEAD`'" main.go
GOPATH=`pwd` GOOS=darwin GOARCH=386 go build -o fileserver_darwin32 -ldflags "-w -s -X 'main.VERSION=$BIN_VERSION' -X 'main.BUILD_TIME=build_time:`date`' -X 'main.GO_VERSION=`go version`' -X 'main.GIT_VERSION=git_version:`git rev-parse HEAD`'" main.go

View File

@ -22,7 +22,7 @@ func main() {
dfs.BUILD_TIME = BUILD_TIME
dfs.GO_VERSION = GO_VERSION
dfs.GIT_VERSION = GIT_VERSION
root := cobra.Command{Use: "go_fastdfs"}
root := cobra.Command{Use: "fileserver"}
root.AddCommand(
version.Cmd,
doc.Cmd,