-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: run rekres (update to Go 1.22)
Update `handlers` function to match new `http.ServeMux` internals. Signed-off-by: Dmitriy Matrenichev <[email protected]>
- Loading branch information
Showing
9 changed files
with
116 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
# syntax = docker/dockerfile-upstream:1.5.2-labs | ||
# syntax = docker/dockerfile-upstream:1.6.0-labs | ||
|
||
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT. | ||
# | ||
# Generated on 2023-07-10T16:20:59Z by kres latest. | ||
# Generated on 2024-02-08T22:38:02Z by kres latest. | ||
|
||
ARG TOOLCHAIN | ||
|
||
# cleaned up specs and compiled versions | ||
FROM scratch AS generate | ||
|
||
# runs markdownlint | ||
FROM docker.io/node:20.3.1-alpine3.18 AS lint-markdown | ||
FROM docker.io/node:21.6.1-alpine3.19 AS lint-markdown | ||
WORKDIR /src | ||
RUN npm i -g markdownlint-cli@0.34.0 | ||
RUN npm i -g markdownlint-cli@0.39.0 | ||
RUN npm i [email protected] | ||
COPY .markdownlint.json . | ||
COPY ./README.md ./README.md | ||
|
@@ -27,6 +27,10 @@ FROM --platform=${BUILDPLATFORM} toolchain AS tools | |
ENV GO111MODULE on | ||
ARG CGO_ENABLED | ||
ENV CGO_ENABLED ${CGO_ENABLED} | ||
ARG GOTOOLCHAIN | ||
ENV GOTOOLCHAIN ${GOTOOLCHAIN} | ||
ARG GOEXPERIMENT | ||
ENV GOEXPERIMENT ${GOEXPERIMENT} | ||
ENV GOPATH /go | ||
ARG DEEPCOPY_VERSION | ||
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg go install github.com/siderolabs/deep-copy@${DEEPCOPY_VERSION} \ | ||
|
@@ -55,6 +59,8 @@ COPY ./debug.go ./debug.go | |
COPY ./debug_off.go ./debug_off.go | ||
COPY ./debug_off_test.go ./debug_off_test.go | ||
COPY ./debug_on.go ./debug_on.go | ||
COPY ./debug_on_121.go ./debug_on_121.go | ||
COPY ./debug_on_122.go ./debug_on_122.go | ||
COPY ./debug_on_test.go ./debug_on_test.go | ||
COPY ./race_off.go ./race_off.go | ||
COPY ./race_on.go ./race_on.go | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
// | ||
//go:build !go1.22 | ||
|
||
package debug | ||
|
||
import ( | ||
"net/http" | ||
"reflect" | ||
"slices" | ||
) | ||
|
||
// handlers returns all patterns registered on the default HTTP server mux. | ||
// Useful to check for unexpected handlers. | ||
func handlers() []string { | ||
keys := reflect.ValueOf(http.DefaultServeMux).Elem().FieldByName("m").MapKeys() | ||
|
||
res := make([]string, len(keys)) | ||
for i, v := range keys { | ||
res[i] = v.String() | ||
} | ||
|
||
slices.Sort(res) | ||
|
||
return res | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
// | ||
//go:build go1.22 && !go1.23 | ||
|
||
package debug | ||
|
||
import ( | ||
"net/http" | ||
"reflect" | ||
"slices" | ||
) | ||
|
||
// handlers returns all patterns registered on the default HTTP server mux. | ||
// Useful to check for unexpected handlers. | ||
func handlers() []string { | ||
// This will only work for Go 1.22, since `http.ServeMux.patterns` contains "remove if possible" comment string | ||
// from Go developers. | ||
patterns := reflect.ValueOf(http.DefaultServeMux).Elem().FieldByName("patterns") | ||
pLen := patterns.Len() | ||
|
||
res := make([]string, pLen) | ||
for i := 0; i < pLen; i++ { | ||
res[i] = patterns.Index(i).Elem().FieldByName("str").String() | ||
} | ||
|
||
slices.Sort(res) | ||
|
||
return res | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters