mirror of
https://github.com/hanzoai/dns.git
synced 2026-10-30 18:40:55 +00:00
The mechanical migration (9b8e9a14b) left the tree uncompilable: it used
luxfi/metric as a prometheus drop-in, but several symbols were missing and a
few types were misused. Finish it against luxfi/metric v1.8.2 (which adds the
prometheus-compat surface):
- pin luxfi/metric v1.8.2 (native-histogram HistogramOpts fields, package
MustRegister/Unregister, AlreadyRegisteredError, With/AutoFactory,
GoCollectorOption/MetricsAll, Vec.Delete, no-op collector registration)
- use metric.Registry / metric.{Histogram,Counter}Vec as INTERFACES, not
concrete pointers (plugin/metrics, plugin/kubernetes)
- build with -tags metrics so luxfi/metric's collecting registry is active
(the default is a //go:build metrics no-op stub); wire it into Makefile
GOTAGS, the GHCR image build, and the CI test matrix
- test harness: select a metric-name validation scheme for the exposition
parser (client_golang used to set the global default; CoreDNS no longer
imports it)
go build ./... + go test -tags metrics ./plugin/metrics/... /kubernetes /reload
are green.
47 lines
1.1 KiB
Makefile
47 lines
1.1 KiB
Makefile
# Makefile for building CoreDNS
|
|
GITCOMMIT?=$(shell git describe --dirty --always)
|
|
BINARY:=coredns
|
|
SYSTEM:=
|
|
CHECKS:=check
|
|
BUILDOPTS?=-v
|
|
# metrics: activate luxfi/metric's collecting registry (the default is a no-op
|
|
# stub gated behind //go:build metrics); CoreDNS's /metrics needs it.
|
|
GOTAGS?=grpcnotrace metrics
|
|
GOPATH?=$(HOME)/go
|
|
MAKEPWD:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
|
|
CGO_ENABLED?=0
|
|
GOLANG_VERSION ?= $(shell cat .go-version)
|
|
STRIP_FLAGS?=-s -w
|
|
LDFLAGS?=-ldflags="$(STRIP_FLAGS) -X github.com/coredns/coredns/coremain.GitCommit=$(GITCOMMIT)"
|
|
|
|
export GOSUMDB = sum.golang.org
|
|
export GOTOOLCHAIN = go$(GOLANG_VERSION)
|
|
|
|
.PHONY: all
|
|
all: coredns
|
|
|
|
.PHONY: coredns
|
|
coredns: $(CHECKS)
|
|
CGO_ENABLED=$(CGO_ENABLED) $(SYSTEM) go build $(BUILDOPTS) -tags="$(GOTAGS)" $(LDFLAGS) -o $(BINARY)
|
|
|
|
.PHONY: check
|
|
check: core/plugin/zplugin.go core/dnsserver/zdirectives.go
|
|
|
|
core/plugin/zplugin.go core/dnsserver/zdirectives.go: plugin.cfg
|
|
go generate coredns.go
|
|
go get
|
|
|
|
.PHONY: gen
|
|
gen:
|
|
go generate coredns.go
|
|
go get
|
|
|
|
.PHONY: pb
|
|
pb:
|
|
$(MAKE) -C pb
|
|
|
|
.PHONY: clean
|
|
clean:
|
|
go clean
|
|
rm -f coredns
|