From d05391e244af4f73798f2a4e40c394837adb551d Mon Sep 17 00:00:00 2001 From: Elliot Date: Wed, 30 Oct 2019 08:19:17 +1100 Subject: [PATCH] update ci to use go 1.13, switch to golangci-lint --- .travis.yml | 2 +- Dockerfile | 6 +----- Dockerfile.dev | 2 +- Makefile | 5 ++--- README.md | 2 +- scripts/check.sh | 30 ++++++++++-------------------- scripts/devtools.sh | 9 +-------- scripts/test.sh | 2 +- 8 files changed, 18 insertions(+), 40 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3d51d69a..6f4d9cfd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: go go: - - 1.11.x + - 1.13.x script: - scripts/devtools.sh - make local build diff --git a/Dockerfile b/Dockerfile index 63867d44..32060934 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.11 as builder +FROM golang:1.13 as builder WORKDIR /go/src/mikefarah/yq @@ -6,10 +6,6 @@ WORKDIR /go/src/mikefarah/yq COPY ./scripts/devtools.sh /go/src/mikefarah/yq/scripts/devtools.sh RUN ./scripts/devtools.sh -# cache vendor -COPY ./vendor/vendor.json /go/src/mikefarah/yq/vendor/vendor.json -RUN govendor sync - COPY . /go/src/mikefarah/yq RUN CGO_ENABLED=0 make local build diff --git a/Dockerfile.dev b/Dockerfile.dev index b39a615b..fb7ddb68 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -1,4 +1,4 @@ -FROM golang:1.9 +FROM golang:1.13 COPY scripts/devtools.sh /opt/devtools.sh diff --git a/Makefile b/Makefile index d854d8fb..22b72069 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ help: @echo ' make build Build yq binary.' @echo ' make install Install yq.' @echo ' make xcompile Build cross-compiled binaries of yq.' - @echo ' make vendor Install dependencies using govendor.' + @echo ' make vendor Install dependencies to vendor directory.' @echo ' make format Run code formatter.' @echo ' make check Run static code analysis (lint).' @echo ' make test Run tests on project.' @@ -71,8 +71,7 @@ install: build # Each of the fetch should be an entry within vendor.json; not currently included within project .PHONY: vendor vendor: tmp/dev_image_id - ${DOCKRUN} govendor sync - @chmod 664 vendor/vendor.json + ${DOCKRUN} go mod vendor # ---------------------------------------------- # develop and test diff --git a/README.md b/README.md index 40461bcc..cb9504fa 100644 --- a/README.md +++ b/README.md @@ -118,7 +118,7 @@ Use "yq [command] --help" for more information about a command. 1. `scripts/devtools.sh` 2. `make [local] vendor` 3. add unit tests -4. apply changes (use govendor with a preference to [gopkg](https://gopkg.in/) for package dependencies) +4. apply changes to go.mod 5. `make [local] build` 6. If required, update the user documentation - Update README.md and/or documentation under the mkdocs folder diff --git a/scripts/check.sh b/scripts/check.sh index 4a31f08f..acbd10de 100755 --- a/scripts/check.sh +++ b/scripts/check.sh @@ -3,24 +3,14 @@ set -o errexit set -o pipefail -gometalinter \ - --skip=examples \ - --tests \ - --vendor \ - --disable=aligncheck \ - --disable=gotype \ - --disable=goconst \ - --cyclo-over=20 \ - --deadline=300s \ - ./... +./bin/golangci-lint run -gometalinter \ - --skip=examples \ - --tests \ - --vendor \ - --disable=aligncheck \ - --disable=gotype \ - --disable=goconst \ - --disable=gocyclo \ - --deadline=300s \ - ./... +# ./bin/golangci-lint \ +# --tests \ +# --vendor \ +# --disable=aligncheck \ +# --disable=gotype \ +# --disable=goconst \ +# --disable=gocyclo \ +# --deadline=300s \ +# ./... diff --git a/scripts/devtools.sh b/scripts/devtools.sh index 6024d31a..6d488f9a 100755 --- a/scripts/devtools.sh +++ b/scripts/devtools.sh @@ -1,10 +1,3 @@ #!/bin/sh -go get -u github.com/alecthomas/gometalinter -go get -u golang.org/x/tools/cmd/goimports -go get -u github.com/mitchellh/gox -go get -u github.com/kardianos/govendor -go get -u github.com/aktau/github-release - -# install all the linters -gometalinter --install --update +wget -O - -q https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.21.0 \ No newline at end of file diff --git a/scripts/test.sh b/scripts/test.sh index 0df446c8..fcba05e2 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -1,3 +1,3 @@ #!/bin/bash -go test -v $(go list ./... | grep -v -E 'vendor|examples') +go test -v $(go list ./... | grep -v -E 'examples')