Skip to content

Commit

Permalink
requires running git update-index --assume-unchanged ./go.mod and sum
Browse files Browse the repository at this point in the history
  • Loading branch information
gbbr committed Jun 3, 2020
1 parent 1e5857c commit cebbf36
Show file tree
Hide file tree
Showing 8 changed files with 922 additions and 68 deletions.
83 changes: 23 additions & 60 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ jobs:
resource_class: xlarge

docker:
- image: circleci/golang:1.12
- image: circleci/golang:1.13
environment:
GO111MODULE: "on"
- image: cassandra:3.7
- image: circleci/mysql:5.7
environment:
Expand Down Expand Up @@ -96,60 +98,26 @@ jobs:
contrib/google.golang.org/grpc.v12/vendor/google.golang.org/grpc
- run:
name: Vendor redis v6.15.3
# This step vendors go-redis/redis v6.15.3 inside our redis contrib
# to allow running the tests against the correct version of
# the redis library.
command: >
git clone --branch v6.15.3
https://github.com/go-redis/redis
contrib/go-redis/redis/vendor/github.com/go-redis/redis
- run:
name: Vendor github.com/googleapis/gnostic for k8s.io/client-go
# This step checks out k8s.io/client-go and vendors
# github.com/googleapis/gnostic to fix a breaking change made in
# gnostic. See kubernetes/client-go#741
# TODO(knusbaum): remove this once the breaking change is resolved or propagated
name: Vendor conflicting dependencies
command: |
git clone --branch v0.17.3 https://github.com/kubernetes/client-go $GOPATH/src/k8s.io/client-go
git clone --branch v0.17.3 https://github.com/kubernetes/apimachinery $GOPATH/src/k8s.io/apimachinery
git clone --branch v0.4.0 https://github.com/googleapis/gnostic $GOPATH/src/k8s.io/client-go/vendor/github.com/googleapis/gnostic
# CircleCI recommends caches be ~500MB. We split the cache into
# two parts to achieve this.
# We specifically do not cache gopkg.in to avoid caching Datadog
# We can cache other packages here or wait to move to go modules
# in the future.
- restore_cache:
keys:
- go-pkg-part-1-cache-v1-{{ checksum "ddtrace/Gopkg.toml" }}
- go-pkg-part-1-cache-v1
go get k8s.io/client-go@v0.17.0
go get k8s.io/apimachinery@v0.17.0
go get github.com/zenazn/goji@64eb341 # tag "v1.0"
- restore_cache:
keys:
- go-pkg-part-2-cache-v2-{{ checksum "ddtrace/Gopkg.toml" }}
- go-pkg-part-2-cache-v2
key: go-pkg-mod-{{ checksum "go.sum" }}

- run:
name: Fetching dependencies
command: |
go get -v -t ./...
go mod tidy
go get -v -u golang.org/x/lint/golint
go get -v -u github.com/alecthomas/gometalinter
- save_cache:
key: go-pkg-part-1-cache-v1-{{ checksum "ddtrace/Gopkg.toml" }}
paths:
- /go/src/github.com
- /go/src/golang.org
curl https://git.io/vp6lP | sh # https://github.com/alecthomas/gometalinter#binary-releases
- save_cache:
key: go-pkg-part-2-cache-v2-{{ checksum "ddtrace/Gopkg.toml" }}
key: go-pkg-mod-{{ checksum "go.sum" }}
paths:
- /go/src/cloud.google.com
- /go/src/google.google.org
- /go/src/go.mongodb.org
- /go/src/go.opencensus.io
- /go/src/golang.org
- /go/src/sigs.k8s.io
- /go/src/k8s.io
- /go/pkg/mod

- run:
name: Vendor klog v0.4.0
Expand Down Expand Up @@ -195,20 +163,15 @@ jobs:
name: Wait for Consul
command: dockerize -wait http://localhost:8500 -timeout 1m

- run:
name: Linting
command: |
gometalinter --disable-all --vendor --deadline=60s \
--enable=golint \
--enable=vet \
./...
# - run:
# name: Linting
# command: |
# gometalinter --disable-all --vendor --deadline=60s \
# --enable=golint \
# --enable=vet \
# ./...

- run:
name: Testing
command: |
mkdir /tmp/test-results
INTEGRATION=1 gotestsum --junitfile /tmp/test-results/result.xml -- -race `go list ./...`
- store_artifacts:
path: /tmp/test-results
- store_test_results:
path: /tmp/test-results
INTEGRATION=1 go test -race `go list ./...`
10 changes: 8 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ bin/

/contrib/google.golang.org/grpc.v12/vendor/

# TODO(gbbr): explain why
/go.sum
# Because of the way Version Selection [1] works with modules,
# if we commit integrations dependencies into go.mod, they
# might force importers of the package to unexpectedly update
# the shared dependency to a higer version than expected,
# potentially introducing unwanted bugs.
#
# [1] https://github.com/golang/go/wiki/Modules#version-selection
#
/go.mod
2 changes: 1 addition & 1 deletion contrib/Shopify/sarama/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ package sarama_test
import (
"log"

"github.com/Shopify/sarama"
saramatrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/Shopify/sarama"
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer"
sarama "gopkg.in/Shopify/sarama.v1"
)

func Example_asyncProducer() {
Expand Down
3 changes: 2 additions & 1 deletion contrib/Shopify/sarama/headers.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ package sarama

import (
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer"
sarama "gopkg.in/Shopify/sarama.v1"

"github.com/Shopify/sarama"
)

// A ProducerMessageCarrier injects and extracts traces from a sarama.ProducerMessage.
Expand Down
2 changes: 1 addition & 1 deletion contrib/Shopify/sarama/sarama.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext"
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer"

sarama "gopkg.in/Shopify/sarama.v1"
"github.com/Shopify/sarama"
)

type partitionConsumer struct {
Expand Down
5 changes: 3 additions & 2 deletions contrib/Shopify/sarama/sarama_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ import (
"testing"
"time"

"github.com/stretchr/testify/assert"
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/ext"
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/mocktracer"
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer"
sarama "gopkg.in/Shopify/sarama.v1"

"github.com/Shopify/sarama"
"github.com/stretchr/testify/assert"
)

func TestConsumer(t *testing.T) {
Expand Down
Loading

0 comments on commit cebbf36

Please sign in to comment.