The installation process is same as for master (dev
) version except you need to do one more additional step which is checking out tag v0.25.0
after cloning the repo to temporary directory:
dir=$(mktemp -d)
git clone https://github.com/go-swagger/go-swagger "$dir"
cd "$dir"
# Checkout version v0.25.0
git checkout v0.25.0
# Continue with installation, instead of
# go install ./cmd/swagger
# use this which just adds version information (current tag) and commit id to binary
go install -ldflags "-X github.com/go-swagger/go-swagger/cmd/swagger/commands.Version=$(git describe --tags) -X github.com/go-swagger/go-swagger/cmd/swagger/commands.Commit=$(git rev-parse HEAD)" ./cmd/swagger
NOTE: If you do just go install ./cmd/swagger
it will technically still install v0.25.0 but swagger version
subcommand will report it as dev
. The version information is just a cosmetic thing passed from git repository down as content of variables in commands
package and you can see how authors do it in their CircleCI config file here. Eventually you can add also other flags to get static build (but they don't do that in official Installing from source instructions).
Once done you should have go-swagger v0.25.0 installed in your $GOPATH/bin
, verify with:
$ swagger version
version: v0.25.0
commit: f032690aab0634d97e2861a708d8fd9365ba77d2
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…