Skip to content

Commit

Permalink
fix: version error
Browse files Browse the repository at this point in the history
  • Loading branch information
CatchZeng committed Sep 15, 2020
1 parent 4f0c178 commit 3c4e542
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
12 changes: 5 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
# CHANGELOG

## v2.1.0
## v1.2.0

### Refactor

- project layout

### Added

- support config.xml
- validate function
- .editconfig file

## v2.0.0

### Refactor

- project layout

## v1.1.1

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ BASEDIR = $(shell pwd)
export GO111MODULE=on

APP_NAME=dingtalk
APP_VERSION=2.1.0
APP_VERSION=1.2.0
IMAGE_NAME="catchzeng/${APP_NAME}:${APP_VERSION}"
IMAGE_LATEST="catchzeng/${APP_NAME}:latest"

Expand Down
9 changes: 7 additions & 2 deletions cmd/dingtalk/version.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
package dingtalk

import (
"github.com/CatchZeng/gutils/version"
"log"

v "github.com/CatchZeng/gutils/version"
"github.com/spf13/cobra"
)

const (
version = "1.2.0"
buildTime = "2020/09/15"
)

// versionCmd represents the version command
var versionCmd = &cobra.Command{
Use: "version",
Expand All @@ -16,7 +21,7 @@ var versionCmd = &cobra.Command{
}

func runVersionCmd(_ *cobra.Command, _ []string) {
v := version.Stringify("2.1.0", "2020/08/21")
v := v.Stringify(version, buildTime)
log.Println(v)
}

Expand Down
5 changes: 3 additions & 2 deletions cmd/dingtalk/version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ package dingtalk

import (
"bytes"
"github.com/CatchZeng/gutils/version"
"log"
"os"
"strings"
"testing"

v "github.com/CatchZeng/gutils/version"

"github.com/spf13/cobra"
)

Expand All @@ -20,7 +21,7 @@ func Test_runVersionCmd(t *testing.T) {
runVersionCmd(&cobra.Command{}, []string{})
got := buf.String()

want := version.Stringify("2.1.0", "2020/08/21")
want := v.Stringify(version, buildTime)

if !strings.Contains(got, want) {
t.Errorf("runVersionCmd() = %v, want %v", got, want)
Expand Down

0 comments on commit 3c4e542

Please sign in to comment.