Skip to content

Commit 2feda42

Browse files
bwplotkakakkoyun
andauthored
Fixed README & CHANGELOG; Added fmt makefile command (+bingo) for easier contributions. (#1289)
* Fixed README; Added fmt command for easier contributions. Signed-off-by: bwplotka <[email protected]> * Updated golint. Signed-off-by: bwplotka <[email protected]> * Update Makefile Co-authored-by: Kemal Akkoyun <[email protected]> Signed-off-by: Bartlomiej Plotka <[email protected]> --------- Signed-off-by: bwplotka <[email protected]> Signed-off-by: Bartlomiej Plotka <[email protected]> Co-authored-by: Kemal Akkoyun <[email protected]>
1 parent 5b9cf9c commit 2feda42

File tree

15 files changed

+96
-16
lines changed

15 files changed

+96
-16
lines changed

.bingo/.gitignore

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
# Ignore everything
3+
*
4+
5+
# But not these files:
6+
!.gitignore
7+
!*.mod
8+
!*.sum
9+
!README.md
10+
!Variables.mk
11+
!variables.env
12+
13+
*tmp.mod

.bingo/README.md

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Project Development Dependencies.
2+
3+
This is directory which stores Go modules with pinned buildable package that is used within this repository, managed by https://github.com/bwplotka/bingo.
4+
5+
* Run `bingo get` to install all tools having each own module file in this directory.
6+
* Run `bingo get <tool>` to install <tool> that have own module file in this directory.
7+
* For Makefile: Make sure to put `include .bingo/Variables.mk` in your Makefile, then use $(<upper case tool name>) variable where <tool> is the .bingo/<tool>.mod.
8+
* For shell: Run `source .bingo/variables.env` to source all environment variable for each tool.
9+
* For go: Import `.bingo/variables.go` to for variable names.
10+
* See https://github.com/bwplotka/bingo or -h on how to add, remove or change binaries dependencies.
11+
12+
## Requirements
13+
14+
* Go 1.14+

.bingo/Variables.mk

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Auto generated binary variables helper managed by https://github.com/bwplotka/bingo v0.8. DO NOT EDIT.
2+
# All tools are designed to be build inside $GOBIN.
3+
BINGO_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
4+
GOPATH ?= $(shell go env GOPATH)
5+
GOBIN ?= $(firstword $(subst :, ,${GOPATH}))/bin
6+
GO ?= $(shell which go)
7+
8+
# Below generated variables ensure that every time a tool under each variable is invoked, the correct version
9+
# will be used; reinstalling only if needed.
10+
# For example for goimports variable:
11+
#
12+
# In your main Makefile (for non array binaries):
13+
#
14+
#include .bingo/Variables.mk # Assuming -dir was set to .bingo .
15+
#
16+
#command: $(GOIMPORTS)
17+
# @echo "Running goimports"
18+
# @$(GOIMPORTS) <flags/args..>
19+
#
20+
GOIMPORTS := $(GOBIN)/goimports-v0.9.3
21+
$(GOIMPORTS): $(BINGO_DIR)/goimports.mod
22+
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
23+
@echo "(re)installing $(GOBIN)/goimports-v0.9.3"
24+
@cd $(BINGO_DIR) && GOWORK=off $(GO) build -mod=mod -modfile=goimports.mod -o=$(GOBIN)/goimports-v0.9.3 "golang.org/x/tools/cmd/goimports"
25+

.bingo/go.mod

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module _ // Fake go.mod auto-created by 'bingo' for go -moddir compatibility with non-Go projects. Commit this file, together with other .mod files.

.bingo/goimports.mod

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT
2+
3+
go 1.20
4+
5+
require golang.org/x/tools v0.9.3 // cmd/goimports

.bingo/goimports.sum

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk=
2+
golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
3+
golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
4+
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
5+
golang.org/x/tools v0.9.3 h1:Gn1I8+64MsuTb/HpH+LmQtNas23LhUVr3rYZ0eKuaMM=
6+
golang.org/x/tools v0.9.3/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc=

.bingo/variables.env

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Auto generated binary variables helper managed by https://github.com/bwplotka/bingo v0.8. DO NOT EDIT.
2+
# All tools are designed to be build inside $GOBIN.
3+
# Those variables will work only until 'bingo get' was invoked, or if tools were installed via Makefile's Variables.mk.
4+
GOBIN=${GOBIN:=$(go env GOBIN)}
5+
6+
if [ -z "$GOBIN" ]; then
7+
GOBIN="$(go env GOPATH)/bin"
8+
fi
9+
10+
11+
GOIMPORTS="${GOBIN}/goimports-v0.9.3"
12+

.github/workflows/go.yml

-3
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@ jobs:
3737
env:
3838
CI: true
3939

40-
- name: Run lint
41-
run: make lint
42-
4340
- name: Run style and unused
4441
if: ${{ matrix.go_version == '1.20' }}
4542
run: make style unused

.github/workflows/golangci-lint.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ jobs:
3232
run: sudo apt-get update && sudo apt-get -y install libsnmp-dev
3333
if: github.repository == 'prometheus/snmp_exporter'
3434
- name: Lint
35-
uses: golangci/golangci-lint-action@v3.2.0
35+
uses: golangci/golangci-lint-action@v3.4.0
3636
with:
37-
version: v1.45.2
37+
args: --verbose
38+
version: v1.51.2

CHANGELOG.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
## Unreleased
22

3-
## 1.15.0 / 2023-04-13
4-
5-
## What's Changed
3+
## 1.15.1 / 2023-05-3
64

75
* [BUGFIX] Fixed promhttp.Instrument* handlers wrongly trying to attach exemplar to unsupported metrics (e.g. summary), \
86
causing panics #1253
97

10-
## What's Changed
8+
## 1.15.0 / 2023-04-13
119

1210
* [BUGFIX] Fix issue with atomic variables on ppc64le #1171
1311
* [BUGFIX] Support for multiple samples within same metric #1181

Makefile

+6
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# See the License for the specific language governing permissions and
1212
# limitations under the License.
1313

14+
include .bingo/Variables.mk
1415
include Makefile.common
1516

1617
.PHONY: test
@@ -26,3 +27,8 @@ generate-go-collector-test-files:
2627
docker run --rm -v $(PWD):/workspace -w /workspace golang:$$GO_VERSION go run prometheus/gen_go_collector_metrics_set.go; \
2728
mv -f go_collector_metrics* prometheus; \
2829
done
30+
31+
.PHONY: fmt
32+
fmt: common-format
33+
$(GOIMPORTS) -local github.com/prometheus/client_golang -w .
34+

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Prometheus Go client library
22

3-
[![CI](https://github.com/prometheus/client_golang/actions/workflows/ci.yml/badge.svg)](https://github.com/prometheus/client_golang/actions/workflows/ci.yml)
4-
[[![Go Report Card](https://goreportcard.com/badge/github.com/prometheus/client_golang)](https://goreportcard.com/report/github.com/prometheus/client_golang)
3+
[![CI](https://github.com/prometheus/client_golang/actions/workflows/go.yml/badge.svg)](https://github.com/prometheus/client_golang/actions/workflows/ci.yml)
4+
[![Go Report Card](https://goreportcard.com/badge/github.com/prometheus/client_golang)](https://goreportcard.com/report/github.com/prometheus/client_golang)
55
[![Go Reference](https://pkg.go.dev/badge/github.com/prometheus/client_golang.svg)](https://pkg.go.dev/github.com/prometheus/client_golang)
66
[![Slack](https://img.shields.io/badge/join%20slack-%23prometheus--client_golang-brightgreen.svg)](https://slack.cncf.io/)
77

@@ -79,7 +79,7 @@ To cut a minor version:
7979
3. Change the `VERSION` file.
8080
4. Update `CHANGELOG` (only user-impacting changes to mention).
8181
5. Create PR, and get it reviewed.
82-
6. Once merged, create a release with the `release-<major>.<minor>` tag on GitHub with the `<version> / <date>` title.
82+
6. Once merged, create a release with the `release-<major>.<minor>` tag on GitHub with the `<version>` title.
8383
7. Announce on the prometheus-announce mailing list, slack and Twitter.
8484
8. Merge the release branch back to the `main` using the "merge without squashing" approach (!).
8585

prometheus/desc.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ import (
1818
"sort"
1919
"strings"
2020

21-
"github.com/prometheus/client_golang/prometheus/internal"
22-
2321
"github.com/cespare/xxhash/v2"
2422
dto "github.com/prometheus/client_model/go"
2523
"github.com/prometheus/common/model"
2624
"google.golang.org/protobuf/proto"
25+
26+
"github.com/prometheus/client_golang/prometheus/internal"
2727
)
2828

2929
// Desc is the descriptor used by every Prometheus Metric. It is essentially

tutorial/whatsup/main.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,12 @@ import (
3131
"github.com/efficientgo/core/errcapture"
3232
"github.com/efficientgo/core/errors"
3333
"github.com/oklog/run"
34+
"github.com/prometheus/common/model"
35+
3436
"github.com/prometheus/client_golang/api"
3537
v1 "github.com/prometheus/client_golang/api/prometheus/v1"
3638
"github.com/prometheus/client_golang/prometheus"
3739
"github.com/prometheus/client_golang/tutorial/internal"
38-
"github.com/prometheus/common/model"
3940
)
4041

4142
func main() {

tutorial/whatsup/reference/main.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,15 @@ import (
3131
"github.com/efficientgo/core/errcapture"
3232
"github.com/efficientgo/core/errors"
3333
"github.com/oklog/run"
34+
"github.com/prometheus/common/model"
35+
3436
"github.com/prometheus/client_golang/api"
3537
v1 "github.com/prometheus/client_golang/api/prometheus/v1"
3638
"github.com/prometheus/client_golang/prometheus"
3739
"github.com/prometheus/client_golang/prometheus/collectors"
3840
"github.com/prometheus/client_golang/prometheus/promauto"
3941
"github.com/prometheus/client_golang/prometheus/promhttp"
4042
"github.com/prometheus/client_golang/tutorial/internal"
41-
"github.com/prometheus/common/model"
4243
)
4344

4445
func main() {

0 commit comments

Comments
 (0)