Fixed README & CHANGELOG; Added fmt makefile command (+bingo) for easier contributions. (#1289)

* Fixed README; Added fmt command for easier contributions.

Signed-off-by: bwplotka <bwplotka@gmail.com>

* Updated golint.

Signed-off-by: bwplotka <bwplotka@gmail.com>

* Update Makefile

Co-authored-by: Kemal Akkoyun <kakkoyun@users.noreply.github.com>
Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>

---------

Signed-off-by: bwplotka <bwplotka@gmail.com>
Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>
Co-authored-by: Kemal Akkoyun <kakkoyun@users.noreply.github.com>
This commit is contained in:
Bartlomiej Plotka 2023-06-13 15:54:49 +02:00 committed by GitHub
parent 5b9cf9c6a8
commit 2feda42e44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 96 additions and 16 deletions

13
.bingo/.gitignore vendored Normal file
View File

@ -0,0 +1,13 @@
# Ignore everything
*
# But not these files:
!.gitignore
!*.mod
!*.sum
!README.md
!Variables.mk
!variables.env
*tmp.mod

14
.bingo/README.md Normal file
View File

@ -0,0 +1,14 @@
# Project Development Dependencies.
This is directory which stores Go modules with pinned buildable package that is used within this repository, managed by https://github.com/bwplotka/bingo.
* Run `bingo get` to install all tools having each own module file in this directory.
* Run `bingo get <tool>` to install <tool> that have own module file in this directory.
* 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.
* For shell: Run `source .bingo/variables.env` to source all environment variable for each tool.
* For go: Import `.bingo/variables.go` to for variable names.
* See https://github.com/bwplotka/bingo or -h on how to add, remove or change binaries dependencies.
## Requirements
* Go 1.14+

25
.bingo/Variables.mk Normal file
View File

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

1
.bingo/go.mod Normal file
View File

@ -0,0 +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.

5
.bingo/goimports.mod Normal file
View File

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

6
.bingo/goimports.sum Normal file
View File

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

12
.bingo/variables.env Normal file
View File

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

View File

@ -37,9 +37,6 @@ jobs:
env:
CI: true
- name: Run lint
run: make lint
- name: Run style and unused
if: ${{ matrix.go_version == '1.20' }}
run: make style unused

View File

@ -32,6 +32,7 @@ jobs:
run: sudo apt-get update && sudo apt-get -y install libsnmp-dev
if: github.repository == 'prometheus/snmp_exporter'
- name: Lint
uses: golangci/golangci-lint-action@v3.2.0
uses: golangci/golangci-lint-action@v3.4.0
with:
version: v1.45.2
args: --verbose
version: v1.51.2

View File

@ -1,13 +1,11 @@
## Unreleased
## 1.15.0 / 2023-04-13
## What's Changed
## 1.15.1 / 2023-05-3
* [BUGFIX] Fixed promhttp.Instrument* handlers wrongly trying to attach exemplar to unsupported metrics (e.g. summary), \
causing panics #1253
## What's Changed
## 1.15.0 / 2023-04-13
* [BUGFIX] Fix issue with atomic variables on ppc64le #1171
* [BUGFIX] Support for multiple samples within same metric #1181

View File

@ -11,6 +11,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
include .bingo/Variables.mk
include Makefile.common
.PHONY: test
@ -26,3 +27,8 @@ generate-go-collector-test-files:
docker run --rm -v $(PWD):/workspace -w /workspace golang:$$GO_VERSION go run prometheus/gen_go_collector_metrics_set.go; \
mv -f go_collector_metrics* prometheus; \
done
.PHONY: fmt
fmt: common-format
$(GOIMPORTS) -local github.com/prometheus/client_golang -w .

View File

@ -1,7 +1,7 @@
# Prometheus Go client library
[![CI](https://github.com/prometheus/client_golang/actions/workflows/ci.yml/badge.svg)](https://github.com/prometheus/client_golang/actions/workflows/ci.yml)
[[![Go Report Card](https://goreportcard.com/badge/github.com/prometheus/client_golang)](https://goreportcard.com/report/github.com/prometheus/client_golang)
[![CI](https://github.com/prometheus/client_golang/actions/workflows/go.yml/badge.svg)](https://github.com/prometheus/client_golang/actions/workflows/ci.yml)
[![Go Report Card](https://goreportcard.com/badge/github.com/prometheus/client_golang)](https://goreportcard.com/report/github.com/prometheus/client_golang)
[![Go Reference](https://pkg.go.dev/badge/github.com/prometheus/client_golang.svg)](https://pkg.go.dev/github.com/prometheus/client_golang)
[![Slack](https://img.shields.io/badge/join%20slack-%23prometheus--client_golang-brightgreen.svg)](https://slack.cncf.io/)
@ -79,7 +79,7 @@ To cut a minor version:
3. Change the `VERSION` file.
4. Update `CHANGELOG` (only user-impacting changes to mention).
5. Create PR, and get it reviewed.
6. Once merged, create a release with the `release-<major>.<minor>` tag on GitHub with the `<version> / <date>` title.
6. Once merged, create a release with the `release-<major>.<minor>` tag on GitHub with the `<version>` title.
7. Announce on the prometheus-announce mailing list, slack and Twitter.
8. Merge the release branch back to the `main` using the "merge without squashing" approach (!).

View File

@ -18,12 +18,12 @@ import (
"sort"
"strings"
"github.com/prometheus/client_golang/prometheus/internal"
"github.com/cespare/xxhash/v2"
dto "github.com/prometheus/client_model/go"
"github.com/prometheus/common/model"
"google.golang.org/protobuf/proto"
"github.com/prometheus/client_golang/prometheus/internal"
)
// Desc is the descriptor used by every Prometheus Metric. It is essentially

View File

@ -31,11 +31,12 @@ import (
"github.com/efficientgo/core/errcapture"
"github.com/efficientgo/core/errors"
"github.com/oklog/run"
"github.com/prometheus/common/model"
"github.com/prometheus/client_golang/api"
v1 "github.com/prometheus/client_golang/api/prometheus/v1"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/tutorial/internal"
"github.com/prometheus/common/model"
)
func main() {

View File

@ -31,6 +31,8 @@ import (
"github.com/efficientgo/core/errcapture"
"github.com/efficientgo/core/errors"
"github.com/oklog/run"
"github.com/prometheus/common/model"
"github.com/prometheus/client_golang/api"
v1 "github.com/prometheus/client_golang/api/prometheus/v1"
"github.com/prometheus/client_golang/prometheus"
@ -38,7 +40,6 @@ import (
"github.com/prometheus/client_golang/prometheus/promauto"
"github.com/prometheus/client_golang/prometheus/promhttp"
"github.com/prometheus/client_golang/tutorial/internal"
"github.com/prometheus/common/model"
)
func main() {