From 897831af1db9c1f3b4a91bcfd8242b59abac3e97 Mon Sep 17 00:00:00 2001 From: Yuri Shkuro Date: Wed, 18 Oct 2017 10:13:32 -0400 Subject: [PATCH] Upgrade to Go 1.9 (#410) * Upgrade to Go 1.9 Signed-off-by: Yuri Shkuro --- .travis.yml | 22 ++++++++++------------ Makefile | 36 ++++++++++++++++++++---------------- doc.go | 17 ----------------- glide.lock | 16 ++++++++-------- glide.yaml | 3 ++- scripts/cover.sh | 2 +- scripts/updateLicenses.sh | 2 +- 7 files changed, 42 insertions(+), 56 deletions(-) delete mode 100644 doc.go diff --git a/.travis.yml b/.travis.yml index dd169aa818d..d4a1bacf0bc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,26 +7,22 @@ dist: trusty matrix: include: - - go: 1.7 + - go: 1.9 env: - TESTS=true - COVERAGE=true - - go: 1.7 + - go: 1.9 env: - ALL_IN_ONE=true - - go: 1.7 + - go: 1.9 env: - CROSSDOCK=true - - go: 1.7 + - go: 1.9 env: - DOCKER=true - - go: 1.7 + - go: 1.9 env: - ES_INTEGRATION_TEST=true -# TODO 1.8 tests take way too long to run 900s vs 250s for 1.7 -# - go: 1.8 -# env: -# - TESTS=true services: - docker @@ -42,16 +38,18 @@ env: install: - docker rmi $(docker images -q) || true - - make install_ci + - make install-ci - if [ "$ALL_IN_ONE" == true ]; then bash ./travis/install-ui-deps.sh ; fi - if [ "$DOCKER" == true ]; then bash ./travis/install-ui-deps.sh ; fi - if [ "$CROSSDOCK" == true ]; then bash ./travis/install-crossdock-deps.sh ; fi script: - export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi) - - if [ "$TESTS" == true ]; then make test_ci ; else echo 'skipping tests'; fi - - if [ "$COVERAGE" == true ]; then travis_retry goveralls -coverprofile=cover.out -service=travis-ci || true ; else echo 'skipping coverage'; fi + - if [ "$TESTS" == true ]; then make test-ci ; else echo 'skipping tests'; fi - if [ "$ALL_IN_ONE" == true ]; then bash ./travis/build-all-in-one-image.sh ; else echo 'skipping all_in_one'; fi - if [ "$CROSSDOCK" == true ]; then bash ./travis/build-crossdock.sh ; else echo 'skipping crossdock'; fi - if [ "$DOCKER" == true ]; then bash ./travis/build-docker-images.sh ; else echo 'skipping docker images'; fi - if [ "$ES_INTEGRATION_TEST" == true ]; then bash ./travis/es-integration-test.sh ; else echo 'skipping elastic search integration test'; fi + +after_success: + - if [ "$COVERAGE" == true ]; then travis_retry goveralls -coverprofile=cover.out -service=travis-ci || true ; else echo 'skipping coverage'; fi diff --git a/Makefile b/Makefile index 2619738ab1a..30c9d64977d 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ PROJECT_ROOT=github.com/uber/jaeger -PACKAGES := $(shell glide novendor | grep -v ./thrift-gen/... | grep -v ./examples/...) +TOP_PKGS := $(shell glide novendor | grep -v -e ./thrift-gen/... -e ./examples/... -e ./scripts/...) # all .go files that don't exist in hidden directories ALL_SRC := $(shell find . -name "*.go" | grep -v -e vendor -e thrift-gen \ @@ -7,6 +7,8 @@ ALL_SRC := $(shell find . -name "*.go" | grep -v -e vendor -e thrift-gen \ -e ".*/_.*" \ -e ".*/mocks.*") +ALL_PKGS := $(shell go list $(sort $(dir $(ALL_SRC)))) + export GO15VENDOREXPERIMENT=1 RACE=-race @@ -18,6 +20,7 @@ FMT_LOG=fmt.log LINT_LOG=lint.log MKDOCS_VIRTUAL_ENV=.mkdocs-virtual-env +SED=sed THRIFT_VER=0.9.3 THRIFT_IMG=thrift:$(THRIFT_VER) THRIFT=docker run --rm -u ${shell id -u} -v "${PWD}:/data" $(THRIFT_IMG) thrift @@ -27,7 +30,7 @@ THRIFT_GEN_DIR=thrift-gen PASS=$(shell printf "\033[32mPASS\033[0m") FAIL=$(shell printf "\033[31mFAIL\033[0m") -COLORIZE=sed ''/PASS/s//$(PASS)/'' | sed ''/FAIL/s//$(FAIL)/'' +COLORIZE=$(SED) ''/PASS/s//$(PASS)/'' | $(SED) ''/FAIL/s//$(FAIL)/'' DOCKER_NAMESPACE?=$(USER) DOCKER_TAG?=latest @@ -38,7 +41,7 @@ test-and-lint: test fmt lint .PHONY: go-gen go-gen: - go generate $(PACKAGES) + go generate $(TOP_PKGS) .PHONY: md-to-godoc-gen md-to-godoc-gen: @@ -52,7 +55,7 @@ clean: .PHONY: test test: go-gen - bash -c "set -e; set -o pipefail; $(GOTEST) $(PACKAGES) | $(COLORIZE)" + bash -c "set -e; set -o pipefail; $(GOTEST) $(TOP_PKGS) | $(COLORIZE)" .PHONY: integration-test integration-test: go-gen @@ -69,13 +72,13 @@ fmt: .PHONY: lint lint: - $(GOVET) $(PACKAGES) + $(GOVET) $(TOP_PKGS) @cat /dev/null > $(LINT_LOG) - @$(foreach pkg, $(PACKAGES), $(GOLINT) $(pkg) | grep -v -e pkg/es/wrapper.go -e /mocks/ -e thrift-gen -e thrift-0.9.2 >> $(LINT_LOG) || true;) + @$(foreach pkg, $(TOP_PKGS), $(GOLINT) $(pkg) | grep -v -e pkg/es/wrapper.go -e /mocks/ -e thrift-gen -e thrift-0.9.2 >> $(LINT_LOG) || true;) @[ ! -s "$(LINT_LOG)" ] || (echo "Lint Failures" | cat - $(LINT_LOG) && false) @$(GOFMT) -e -s -l $(ALL_SRC) > $(FMT_LOG) @./scripts/updateLicenses.sh >> $(FMT_LOG) - @[ ! -s "$(FMT_LOG)" ] || (echo "Go Fmt Failures, run 'make fmt'" | cat - $(FMT_LOG) && false) + @[ ! -s "$(FMT_LOG)" ] || (echo "Go fmt or license check failures, run 'make fmt'" | cat - $(FMT_LOG) && false) .PHONY: install-glide install-glide: @@ -87,8 +90,8 @@ install-glide: install: install-glide glide install -.PHONY: build_examples -build_examples: +.PHONY: build-examples +build-examples: go build -o ./examples/hotrod/hotrod-demo ./examples/hotrod/main.go .PHONY: build_ui @@ -156,21 +159,22 @@ build-crossdock-fresh: build-crossdock-bin .PHONY: cover cover: - ./scripts/cover.sh $(shell go list $(PACKAGES)) + ./scripts/cover.sh $(shell go list $(TOP_PKGS)) go tool cover -html=cover.out -o cover.html -.PHONY: install_ci -install_ci: install +.PHONY: install-ci +install-ci: install go get github.com/wadey/gocovmerge go get github.com/mattn/goveralls go get golang.org/x/tools/cmd/cover go get github.com/golang/lint/golint go get github.com/sectioneight/md-to-godoc -.PHONY: test_ci -test_ci: build_examples - @./scripts/cover.sh $(shell go list $(PACKAGES)) - make lint +.PHONY: test-ci +test-ci: build-examples lint + @echo pre-compiling tests + @time go test -i $(ALL_PKGS) + @./scripts/cover.sh $(shell go list $(TOP_PKGS)) # TODO at the moment we're not generating tchan_*.go files .PHONY: thrift diff --git a/doc.go b/doc.go deleted file mode 100644 index b5c23ae08b8..00000000000 --- a/doc.go +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) 2017 Uber Technologies, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Package jaeger hosts the backend components of Jaeger, distributed tracing system. -// For documentation please see http://jaeger.readthedocs.io/ -package jaeger diff --git a/glide.lock b/glide.lock index 1b33ba7463d..505025d8aeb 100644 --- a/glide.lock +++ b/glide.lock @@ -1,5 +1,5 @@ -hash: c0ce4fe6b7f53ab91f35fe0b09184bdc56357bf77a02ee4cea4ec3db2d1437dd -updated: 2017-08-22T14:33:20.951743908-04:00 +hash: 186c8ac164ff232e786b5be66349990e0a87c188de41b193fc6a279d413c0a71 +updated: 2017-10-17T15:33:35.040726046-04:00 imports: - name: github.com/apache/thrift version: 53dd39833a08ce33582e5ff31fa18bb4735d6731 @@ -17,7 +17,7 @@ imports: - assert - require - name: github.com/davecgh/go-spew - version: adab96458c51a58dc1783b3335dcce5461522e75 + version: a476722483882dd40b8111f0eb64e1d7f43f56e4 subpackages: - spew - name: github.com/fsnotify/fsnotify @@ -130,7 +130,7 @@ imports: - name: github.com/stretchr/objx version: 1a9d0bb9f541897e62256577b352fdbc1fb4fd94 - name: github.com/stretchr/testify - version: 05e8a0eda380579888eb53c394909df027f06991 + version: 890a5c3458b43e6104ff5da8dfa139d013d77544 subpackages: - assert - mock @@ -138,7 +138,7 @@ imports: - name: github.com/uber-go/atomic version: 0c9e689d64f004564b79d9a663634756df322902 - name: github.com/uber/jaeger-client-go - version: d021e646f5187d77b55592c3efee1a2810e895d7 + version: 3e3870040def0ebdaf65a003863fa64f5cb26139 subpackages: - config - internal/spanlog @@ -152,7 +152,7 @@ imports: - transport/zipkin - utils - name: github.com/uber/jaeger-lib - version: 575c678b2873b62aaadd0fa5817a2aeb3155dc4d + version: 3b2a9ad2a045881ab7a0f81d465be54c8292ee4f subpackages: - metrics - metrics/go-kit @@ -179,7 +179,7 @@ imports: - name: go.uber.org/multierr version: 3c4937480c32f4c13a875a1829af76c98ca3d40a - name: go.uber.org/zap - version: 9d9d6135afe89b6fc4a05e9a8552526caba38048 + version: 35aad584952c3e7020db7b839f6b102de6271f89 subpackages: - buffer - internal/bufferpool @@ -188,7 +188,7 @@ imports: - zapcore - zaptest - name: golang.org/x/net - version: 1c05540f6879653db88113bc4a2b70aec4bd491f + version: 8351a756f30f1297fe94bbf4b767ec589c6ea6d0 subpackages: - context - context/ctxhttp diff --git a/glide.yaml b/glide.yaml index e3f71898e34..068d10401d3 100644 --- a/glide.yaml +++ b/glide.yaml @@ -4,7 +4,6 @@ import: version: 0.9.3 subpackages: - lib/go/thrift -- package: github.com/codahale/hdrhistogram - package: github.com/gocql/gocql version: 4d2d1ac71932f7c4a6c7feb0d654462e4116c58b - package: github.com/opentracing/opentracing-go @@ -41,3 +40,5 @@ import: - metrics - package: github.com/olivere/elastic version: v5.0.39 +- package: github.com/spf13/cobra +- package: github.com/spf13/viper diff --git a/scripts/cover.sh b/scripts/cover.sh index 4194b92fbc9..63b1104c32a 100755 --- a/scripts/cover.sh +++ b/scripts/cover.sh @@ -52,7 +52,7 @@ for pkg in "$@"; do args="-coverprofile $COVER/cover.${i}.out" # -coverpkg $coverpkg fi - echo go test -v -race "$pkg" + echo go test $args -v -race "$pkg" go test $args -v -race "$pkg" done diff --git a/scripts/updateLicenses.sh b/scripts/updateLicenses.sh index 46c5f85ebae..59140ba28dc 100755 --- a/scripts/updateLicenses.sh +++ b/scripts/updateLicenses.sh @@ -2,4 +2,4 @@ set -e -python scripts/updateLicense.py $(git ls-files "*\.go" | grep -v thrift-gen) +python scripts/updateLicense.py $(git ls-files "*\.go" | grep -v -e thrift-gen)