From 6bdec93fdea3ec5001258394fc294b5e665f4806 Mon Sep 17 00:00:00 2001 From: simeji Date: Fri, 4 Jan 2019 14:44:37 +0900 Subject: [PATCH 1/4] add .log to .gitignore --- .gitignore | 1 + cmd/jid/jid.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 835e37d..1d28b30 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,4 @@ test.* # jid package jid *.out +*.log diff --git a/cmd/jid/jid.go b/cmd/jid/jid.go index 9e9410a..deeb36b 100644 --- a/cmd/jid/jid.go +++ b/cmd/jid/jid.go @@ -8,7 +8,7 @@ import ( "github.com/simeji/jid" ) -const VERSION = "0.7.2" +const VERSION = "0.7.3" func main() { content := os.Stdin From 0047c597108a73c23a287313a8bc2f210f3c37db Mon Sep 17 00:00:00 2001 From: simeji Date: Fri, 4 Jan 2019 14:46:19 +0900 Subject: [PATCH 2/4] Using go mod --- go.mod | 12 ++++++++++++ go.sum | 16 ++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 go.mod create mode 100644 go.sum diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..d26c293 --- /dev/null +++ b/go.mod @@ -0,0 +1,12 @@ +module github.com/simeji/jid + +require ( + github.com/bitly/go-simplejson v0.5.0 + github.com/fatih/color v1.7.0 // indirect + github.com/mattn/go-colorable v0.0.9 // indirect + github.com/mattn/go-isatty v0.0.4 // indirect + github.com/mattn/go-runewidth v0.0.4 + github.com/nsf/termbox-go v0.0.0-20181027232701-60ab7e3d12ed + github.com/nwidger/jsoncolor v0.0.0-20170215171346-75a6de4340e5 + github.com/pkg/errors v0.8.0 +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..2fb379f --- /dev/null +++ b/go.sum @@ -0,0 +1,16 @@ +github.com/bitly/go-simplejson v0.5.0 h1:6IH+V8/tVMab511d5bn4M7EwGXZf9Hj6i2xSwkNEM+Y= +github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngEKAMDJEczWVA= +github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-isatty v0.0.4 h1:bnP0vzxcAdeI1zdubAl5PjU6zsERjGZb7raWodagDYs= +github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/mattn/go-runewidth v0.0.4 h1:2BvfKmzob6Bmd4YsL0zygOqfdFnK7GR4QL06Do4/p7Y= +github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/nsf/termbox-go v0.0.0-20181027232701-60ab7e3d12ed h1:bAVGG6B+R5qpSylrrA+BAMrzYkdAoiTaKPVxRB+4cyM= +github.com/nsf/termbox-go v0.0.0-20181027232701-60ab7e3d12ed/go.mod h1:IuKpRQcYE1Tfu+oAQqaLisqDeXgjyyltCfsaoYN18NQ= +github.com/nwidger/jsoncolor v0.0.0-20170215171346-75a6de4340e5 h1:d+C3xJdxZT7wNlxqEwbXn3R355CwAhYBL9raVNfSnK0= +github.com/nwidger/jsoncolor v0.0.0-20170215171346-75a6de4340e5/go.mod h1:GYFm0zZgTNeoK1QxuIofRDasy2ibmaJZhZLzwsMXUF4= +github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= From 90dcf153e8230fe7c64a4b05b0899a639d4215df Mon Sep 17 00:00:00 2001 From: simeji Date: Fri, 4 Jan 2019 15:16:53 +0900 Subject: [PATCH 3/4] Replace gox with goreleaser --- .circleci/config.yml | 55 ++++++++------------------------------------ .goreleaser.yml | 40 ++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 45 deletions(-) create mode 100644 .goreleaser.yml diff --git a/.circleci/config.yml b/.circleci/config.yml index 453fb18..94976f4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -5,61 +5,26 @@ jobs: - image: circleci/golang:latest steps: - checkout - - run: go get -v -t -d ./... - run: go test -v ./ - run: go test -v ./cmd/jid - build: + release: docker: - image: circleci/golang:latest steps: - checkout - run: - name: update packages - command: go get -v -t -d ./... - - run: - name: install gox - command: go get github.com/mitchellh/gox - - run: - name: build jid - command: cd cmd/jid && gox -ldflags '-w -s' - - persist_to_workspace: - root: . - paths: - - cmd/jid/* - deploy: - docker: - - image: circleci/golang:latest - steps: - - attach_workspace: - at: . - - run: - name: make a zip dir - command: mkdir builds - - run: - name: create zip files - command: | - for name in `cd cmd/jid && find jid_* | grep -v .go`; do - zip builds/${name}.zip cmd/jid/$name - done - - run: - name: list binary - command: ls builds + name: build jid using goreleaser + command: curl -sL https://git.io/goreleaser | bash workflows: version: 2 - build_and_deploy: + test_and_release: jobs: - test - - build: + - release: requires: - test -# filters: -# tags: -# only: /.*/ - - deploy: - requires: - - build -# filters: -# tags: -# only: /.*/ -# branches: -# only: master \ No newline at end of file + filters: + branches: + ignore: /.*/ + tags: + only: /v[0-9]+(\.[0-9]+)*(-.*)*/ diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..22513eb --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,40 @@ +# This is an example goreleaser.yaml file with some sane defaults. +# Make sure to check the documentation at http://goreleaser.com +before: + hooks: + # you may remove this if you don't use vgo + - go mod download + # you may remove this if you don't need go generate + - go generate ./... +builds: +- env: + - CGO_ENABLED=0 + ldflags: + - -s -w + goos: + - windows + - openbsd + - netbsd + - linux + - freebsd + - darwin + goarch: + - arm64 + - amd64 + - 386 +archive: + name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}" + format: zip + files: + - none* +checksum: + name_template: 'checksums.txt' +snapshot: + name_template: "{{ .Tag }}-next" +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' + From e35ecb51c6453c95a677859560ab3ee003058c52 Mon Sep 17 00:00:00 2001 From: simeji Date: Fri, 4 Jan 2019 15:45:55 +0900 Subject: [PATCH 4/4] modify goreleaser config --- .gitignore | 1 + .goreleaser.yml | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 1d28b30..18d343a 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,4 @@ test.* jid *.out *.log +dist diff --git a/.goreleaser.yml b/.goreleaser.yml index 22513eb..6438c27 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -9,6 +9,7 @@ before: builds: - env: - CGO_ENABLED=0 + main: ./cmd/jid/jid.go ldflags: - -s -w goos: @@ -37,4 +38,6 @@ changelog: exclude: - '^docs:' - '^test:' - +# for Validation +#release: +# disable: true