Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Go 1.9 #410

Merged
merged 2 commits into from
Oct 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
36 changes: 20 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
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 \
-e ".*/\..*" \
-e ".*/_.*" \
-e ".*/mocks.*")

ALL_PKGS := $(shell go list $(sort $(dir $(ALL_SRC))))

export GO15VENDOREXPERIMENT=1

RACE=-race
Expand All @@ -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
Expand All @@ -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

Expand All @@ -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:
Expand All @@ -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
Expand All @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
17 changes: 0 additions & 17 deletions doc.go

This file was deleted.

16 changes: 8 additions & 8 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion glide.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion scripts/cover.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion scripts/updateLicenses.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)