update
parent
e47242cfb8
commit
5f99ca837d
|
@ -0,0 +1,6 @@
|
||||||
|
# 0.1.2
|
||||||
|
|
||||||
|
## Fix
|
||||||
|
|
||||||
|
* refactor: use cobra and pflag
|
||||||
|
* client mode unreachable in docker
|
11
Makefile
11
Makefile
|
@ -22,10 +22,13 @@ build:
|
||||||
|
|
||||||
build-bins:
|
build-bins:
|
||||||
$(foreach GOOS, $(PLATFORMS), $(foreach GOARCH, $(ARCHITECTURES), \
|
$(foreach GOOS, $(PLATFORMS), $(foreach GOARCH, $(ARCHITECTURES), \
|
||||||
$(shell export GOOS=$(GOOS); export GOARCH=$(GOARCH); go build ${LDFLAGS} -o dist/$(PROJ)_$(VERSION)_$(GOOS)_$(GOARCH))))
|
$(shell export GOOS=$(GOOS); export GOARCH=$(GOARCH); go build ${LDFLAGS} -o dist/$(PROJ)_$(VERSION)_$(GOOS)_$(GOARCH)/$(PROJ))))
|
||||||
|
|
||||||
build-m1:
|
build-m1:
|
||||||
$(shell export GOOS=darwin; export GOARCH=arm64; go build ${LDFLAGS} -o dist/$(PROJ)_$(VERSION)_darwin_arm64)
|
$(shell export GOOS=darwin; export GOARCH=arm64; go build ${LDFLAGS} -o dist/$(PROJ)_$(VERSION)_darwin_arm64/$(PROJ))
|
||||||
|
|
||||||
|
build-zip:
|
||||||
|
cd dist; for f in * ;do tar -czf $${f}.tar.gz $${f}; done
|
||||||
|
|
||||||
docker:
|
docker:
|
||||||
docker build --target builder -t $(HUB)/$(HUB_PROJECT)/$(PROJ):builder .
|
docker build --target builder -t $(HUB)/$(HUB_PROJECT)/$(PROJ):builder .
|
||||||
|
@ -39,9 +42,9 @@ docker-push:
|
||||||
docker push $(HUB)/$(HUB_PROJECT)/$(PROJ):latest
|
docker push $(HUB)/$(HUB_PROJECT)/$(PROJ):latest
|
||||||
|
|
||||||
docker-save:
|
docker-save:
|
||||||
docker save -o dist/$(PROJ)-$(VERSION)-${BUILD}.tar $(HUB)/$(HUB_PROJECT)/$(PROJ):$(VERSION)
|
docker save $(HUB)/$(HUB_PROJECT)/$(PROJ):$(VERSION) | gzip > dist/$(PROJ)-image-$(VERSION)-${BUILD}.tar.gz
|
||||||
|
|
||||||
|
|
||||||
release: build-bins build-m1 docker docker-save docker-push
|
release: clean build-bins build-m1 build-zip docker docker-save docker-push
|
||||||
|
|
||||||
.PHONY: build docker release clean all
|
.PHONY: build docker release clean all
|
4
main.go
4
main.go
|
@ -17,14 +17,14 @@ var versionCmd = &cobra.Command{
|
||||||
Short: "version",
|
Short: "version",
|
||||||
Long: `Print the version number of myip`,
|
Long: `Print the version number of myip`,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
fmt.Println(Version + Build)
|
fmt.Println(Version + "-" + Build)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
log.SetFlags(0)
|
log.SetFlags(0)
|
||||||
log.SetOutput(os.Stdout)
|
log.SetOutput(os.Stdout)
|
||||||
cmd.ClientCmd.Version = Version
|
cmd.ClientCmd.Version = Version + "-" + Build
|
||||||
cmd.ClientCmd.AddCommand(versionCmd)
|
cmd.ClientCmd.AddCommand(versionCmd)
|
||||||
cmd.ClientCmd.AddCommand(cmd.ServerCmd)
|
cmd.ClientCmd.AddCommand(cmd.ServerCmd)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue