diff --git a/.circleci/config.yml b/.circleci/config.yml index 4ad70af..127348e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -50,22 +50,6 @@ workflows: client_golang: jobs: # Refer to README.md for the currently supported versions. - - test: - name: go-1-9 - go_version: "1.9" - use_gomod_cache: false - - test: - name: go-1-10 - go_version: "1.10" - use_gomod_cache: false - - test: - name: go-1-11 - go_version: "1.11" - run_lint: true - - test: - name: go-1-12 - go_version: "1.12" - run_lint: true - test: name: go-1-13 go_version: "1.13" @@ -78,6 +62,10 @@ workflows: name: go-1-15 go_version: "1.15" run_lint: true + - test: + name: go-1-16 + go_version: "1.16" + run_lint: true # Style and unused/missing packages are only checked against # the latest supported Go version. run_style_and_unused: true diff --git a/README.md b/README.md index 9bab32a..e111c36 100644 --- a/README.md +++ b/README.md @@ -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.9 or later.__ The minimum required patch releases for older Go versions are Go1.9.7 and Go1.10.3. +__This library requires Go1.13 or later.__ ## Important note about releases and stability diff --git a/go.mod b/go.mod index 23aba57..65ec5a7 100644 --- a/go.mod +++ b/go.mod @@ -11,4 +11,4 @@ require ( golang.org/x/sys v0.0.0-20210309074719-68d13333faf2 ) -go 1.11 +go 1.13 diff --git a/prometheus/build_info.go b/prometheus/build_info.go deleted file mode 100644 index 288f0e8..0000000 --- a/prometheus/build_info.go +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2019 The Prometheus Authors -// 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. - -// +build go1.12 - -package prometheus - -import "runtime/debug" - -// readBuildInfo is a wrapper around debug.ReadBuildInfo for Go 1.12+. -func readBuildInfo() (path, version, sum string) { - path, version, sum = "unknown", "unknown", "unknown" - if bi, ok := debug.ReadBuildInfo(); ok { - path = bi.Main.Path - version = bi.Main.Version - sum = bi.Main.Sum - } - return -} diff --git a/prometheus/build_info_pre_1.12.go b/prometheus/build_info_pre_1.12.go deleted file mode 100644 index 6609e28..0000000 --- a/prometheus/build_info_pre_1.12.go +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2019 The Prometheus Authors -// 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. - -// +build !go1.12 - -package prometheus - -// readBuildInfo is a wrapper around debug.ReadBuildInfo for Go versions before -// 1.12. Remove this whole file once the minimum supported Go version is 1.12. -func readBuildInfo() (path, version, sum string) { - return "unknown", "unknown", "unknown" -} diff --git a/prometheus/go_collector.go b/prometheus/go_collector.go index 6f67d10..db43ca5 100644 --- a/prometheus/go_collector.go +++ b/prometheus/go_collector.go @@ -384,7 +384,12 @@ type memStatsMetrics []struct { // https://github.com/povilasv/prommod for an example of a collector for the // module dependencies. func NewBuildInfoCollector() Collector { - path, version, sum := readBuildInfo() + path, version, sum := "unknown", "unknown", "unknown" + if bi, ok := debug.ReadBuildInfo(); ok { + path = bi.Main.Path + version = bi.Main.Version + sum = bi.Main.Sum + } c := &selfCollector{MustNewConstMetric( NewDesc( "go_build_info",