diff --git a/.travis.yml b/.travis.yml index 235f8e2..ec0ff73 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: go go: - - 1.2.1 + - 1.4 script: - make -f Makefile diff --git a/Makefile b/Makefile index a09c6e7..0d3689b 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ MAC_OS_X_VERSION ?= 10.8 BUILD_PATH = $(PWD)/.build -export GO_VERSION = 1.2.1 +export GO_VERSION = 1.4 export GOOS = $(subst Darwin,darwin,$(subst Linux,linux,$(OS))) ifeq ($(GOOS),darwin) @@ -29,6 +29,7 @@ endif export GOARCH = $(subst x86_64,amd64,$(ARCH)) export GOPKG = go$(GO_VERSION).$(GOOS)-$(GOARCH)$(RELEASE_SUFFIX).tar.gz +export GOURL = http://golang.org/dl export GOROOT = $(BUILD_PATH)/root/go export GOPATH = $(BUILD_PATH)/root/gopath export GOCC = $(GOROOT)/bin/go @@ -57,7 +58,7 @@ $(BUILD_PATH)/root: $(BUILD_PATH) mkdir -vp $(BUILD_PATH)/root $(BUILD_PATH)/cache/$(GOPKG): $(BUILD_PATH)/cache - curl -o $@ http://go.googlecode.com/files/$(GOPKG) + curl -o $@ -L $(GOURL)/$(GOPKG) $(GOCC): $(BUILD_PATH)/root $(BUILD_PATH)/cache/$(GOPKG) tar -C $(BUILD_PATH)/root -xzf $(BUILD_PATH)/cache/$(GOPKG) diff --git a/prometheus/registry.go b/prometheus/registry.go index cb108f5..65ea520 100644 --- a/prometheus/registry.go +++ b/prometheus/registry.go @@ -33,8 +33,8 @@ import ( dto "github.com/prometheus/client_model/go" - "compress/gzip" "code.google.com/p/goprotobuf/proto" + "compress/gzip" "github.com/prometheus/client_golang/_vendor/goautoneg" "github.com/prometheus/client_golang/model" @@ -424,6 +424,12 @@ func (r *registry) writePB(w io.Writer, writeEncoded encoder) (int, error) { } r.mtx.RUnlock() + // Drain metricChan in case of premature return. + defer func() { + for range metricChan { + } + }() + // Gather. for metric := range metricChan { // This could be done concurrently, too, but it required locking