Skip to content

Update build #956

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ executors:
# should also be updated.
golang:
docker:
- image: cimg/go:1.23
- image: cimg/go:1.24
jobs:
test:
executor: golang
Expand All @@ -18,7 +18,7 @@ jobs:
file: mysqld_exporter
integration:
docker:
- image: cimg/go:1.23
- image: cimg/go:1.24
- image: << parameters.mysql_image >>
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,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@55c2c1448f86e01eaae002a5a3a9624417608d84 # v6.5.2
uses: golangci/golangci-lint-action@1481404843c368bc19ca9406f87d6e0fc97bdcfd # v7.0.0
with:
args: --verbose
version: v1.64.6
version: v2.1.5
25 changes: 21 additions & 4 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
---
# Run only staticcheck for now. Additional linters will be enabled one-by-one.
version: "2"
linters:
default: none
enable:
- misspell
- staticcheck
- sloglint
disable-all: true
- staticcheck
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
paths:
- third_party$
- builtin$
- examples$
formatters:
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
2 changes: 1 addition & 1 deletion .promu.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
go:
# Whenever the Go version is updated here, .circle/config.yml should also
# be updated.
version: 1.23
version: 1.24
repository:
path: github.com/prometheus/mysqld_exporter
build:
Expand Down
13 changes: 9 additions & 4 deletions Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_
SKIP_GOLANGCI_LINT :=
GOLANGCI_LINT :=
GOLANGCI_LINT_OPTS ?=
GOLANGCI_LINT_VERSION ?= v1.64.6
GOLANGCI_LINT_VERSION ?= v2.1.5
GOLANGCI_FMT_OPTS ?=
# golangci-lint only supports linux, darwin and windows platforms on i386/amd64/arm64.
# windows isn't included here because of the path separator being different.
ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin))
Expand Down Expand Up @@ -156,9 +157,13 @@ $(GOTEST_DIR):
@mkdir -p $@

.PHONY: common-format
common-format:
common-format: $(GOLANGCI_LINT)
@echo ">> formatting code"
$(GO) fmt $(pkgs)
ifdef GOLANGCI_LINT
@echo ">> formatting code with golangci-lint"
$(GOLANGCI_LINT) fmt $(GOLANGCI_FMT_OPTS)
endif

.PHONY: common-vet
common-vet:
Expand Down Expand Up @@ -248,8 +253,8 @@ $(PROMU):
cp $(PROMU_TMP)/promu-$(PROMU_VERSION).$(GO_BUILD_PLATFORM)/promu $(FIRST_GOPATH)/bin/promu
rm -r $(PROMU_TMP)

.PHONY: proto
proto:
.PHONY: common-proto
common-proto:
@echo ">> generating code from proto files"
@./scripts/genproto.sh

Expand Down
6 changes: 3 additions & 3 deletions collector/collector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ func readMetric(m prometheus.Metric) MetricResult {

func sanitizeQuery(q string) string {
q = strings.Join(strings.Fields(q), " ")
q = strings.Replace(q, "(", "\\(", -1)
q = strings.Replace(q, ")", "\\)", -1)
q = strings.Replace(q, "*", "\\*", -1)
q = strings.ReplaceAll(q, "(", "\\(")
q = strings.ReplaceAll(q, ")", "\\)")
q = strings.ReplaceAll(q, "*", "\\*")
return q
}
2 changes: 1 addition & 1 deletion collector/engine_tokudb.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func sanitizeTokudbMetric(metricName string) string {
"/": "and",
}
for r := range replacements {
metricName = strings.Replace(metricName, r, replacements[r], -1)
metricName = strings.ReplaceAll(metricName, r, replacements[r])
}
return metricName
}
Expand Down
2 changes: 1 addition & 1 deletion collector/info_schema_innodb_metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func (ScrapeInnodbMetrics) Scrape(ctx context.Context, instance *instance, ch ch
case "ENABLED":
query = fmt.Sprintf(infoSchemaInnodbMetricsQuery, "enabled", "1")
default:
return errors.New("Couldn't find column STATUS or ENABLED in innodb_metrics table.")
return errors.New("couldn't find column STATUS or ENABLED in innodb_metrics table")
}

innodbMetricsRows, err := db.QueryContext(ctx, query)
Expand Down
2 changes: 1 addition & 1 deletion collector/info_schema_innodb_sys_tablespaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func (ScrapeInfoSchemaInnodbTablespaces) Scrape(ctx context.Context, instance *i
query = fmt.Sprintf(innodbTablespacesQueryMariaDB, tablespacesTablename, tablespacesTablename)
}
default:
return errors.New("Couldn't find INNODB_SYS_TABLESPACES or INNODB_TABLESPACES in information_schema.")
return errors.New("couldn't find INNODB_SYS_TABLESPACES or INNODB_TABLESPACES in information_schema")
}

tablespacesRows, err := db.QueryContext(ctx, query)
Expand Down
2 changes: 1 addition & 1 deletion collector/info_schema_processlist.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ func sanitizeState(state string) string {
"-": "_",
}
for r := range replacements {
state = strings.Replace(state, r, replacements[r], -1)
state = strings.ReplaceAll(state, r, replacements[r])
}
return state
}
Expand Down
2 changes: 1 addition & 1 deletion config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func TestValidateConfig(t *testing.T) {
t.Error(err)
}
cfg := c.GetConfig()
section, _ := cfg.Sections["client.server1"]
section := cfg.Sections["client.server1"]
convey.So(section.Password, convey.ShouldEqual, "abc")
})

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/prometheus/mysqld_exporter

go 1.22
go 1.23.0

require (
github.com/DATA-DOG/go-sqlmock v1.5.2
Expand Down