Skip to content

Commit

Permalink
Merge pull request #561 from prometheus/beorn7/go-requirement
Browse files Browse the repository at this point in the history
Increase minimum required Go version to 1.9
  • Loading branch information
beorn7 authored Apr 29, 2019
2 parents deade03 + 1173d73 commit f951755
Show file tree
Hide file tree
Showing 11 changed files with 156 additions and 385 deletions.
8 changes: 3 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
language: go

go:
- 1.7.x # See README.md for current minimum version.
- 1.8.x
- 1.9.x
- 1.9.x # See README.md for current minimum version.
- 1.10.x
- 1.11.x
- 1.12.x

script:
- make check_license unused test-short
- if [[ ! $TRAVIS_GO_VERSION =~ ^1\.(7|8|9)\.[x0-9]+$ ]]; then make lint; fi
# style is only checked against the latest supported Go version.
- if [[ ! $TRAVIS_GO_VERSION =~ ^1\.9\.[x0-9]+$ ]]; then make lint; fi
# Style is only checked against the latest supported Go version.
- if [[ $TRAVIS_GO_VERSION =~ ^1\.(12)\. ]]; then make style; fi
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This is the [Go](http://golang.org) client library for
instrumenting application code, and one for creating clients that talk to the
Prometheus HTTP API.

__This library requires Go1.7 or later.__
__This library requires Go1.9 or later.__

## Important note about releases, versioning, tagging, and stability

Expand Down
2 changes: 0 additions & 2 deletions api/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// +build go1.7

// Package api provides clients for the HTTP APIs.
package api

Expand Down
2 changes: 0 additions & 2 deletions api/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// +build go1.7

package api

import (
Expand Down
2 changes: 0 additions & 2 deletions api/prometheus/v1/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// +build go1.7

// Package v1 provides bindings to the Prometheus HTTP API v1:
// http://prometheus.io/docs/querying/api/
package v1
Expand Down
2 changes: 0 additions & 2 deletions api/prometheus/v1/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// +build go1.7

package v1

import (
Expand Down
29 changes: 29 additions & 0 deletions prometheus/promhttp/delegator.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ type closeNotifierDelegator struct{ *responseWriterDelegator }
type flusherDelegator struct{ *responseWriterDelegator }
type hijackerDelegator struct{ *responseWriterDelegator }
type readerFromDelegator struct{ *responseWriterDelegator }
type pusherDelegator struct{ *responseWriterDelegator }

func (d closeNotifierDelegator) CloseNotify() <-chan bool {
//lint:ignore SA1019 http.CloseNotifier is deprecated but we don't want to
Expand Down Expand Up @@ -198,3 +199,31 @@ func init() {
}{d, readerFromDelegator{d}, hijackerDelegator{d}, flusherDelegator{d}, closeNotifierDelegator{d}}
}
}

func newDelegator(w http.ResponseWriter, observeWriteHeaderFunc func(int)) delegator {
d := &responseWriterDelegator{
ResponseWriter: w,
observeWriteHeader: observeWriteHeaderFunc,
}

id := 0
//lint:ignore SA1019 http.CloseNotifier is deprecated but we don't want to
//remove support from client_golang yet.
if _, ok := w.(http.CloseNotifier); ok {
id += closeNotifier
}
if _, ok := w.(http.Flusher); ok {
id += flusher
}
if _, ok := w.(http.Hijacker); ok {
id += hijacker
}
if _, ok := w.(io.ReaderFrom); ok {
id += readerFrom
}
if _, ok := w.(http.Pusher); ok {
id += pusher
}

return pickDelegator[id](d)
}
183 changes: 0 additions & 183 deletions prometheus/promhttp/delegator_1_8.go

This file was deleted.

44 changes: 0 additions & 44 deletions prometheus/promhttp/delegator_pre_1_8.go

This file was deleted.

Loading

0 comments on commit f951755

Please sign in to comment.