fix versionMatcher: use non-capturing group (?:-dirty)? for gorilla/mux

gorilla/mux explicitly rejects capturing groups () in route regexps,
only non-capturing groups (?:) are allowed. The original regex was
missing the ? to make -dirty optional.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Lei Xue
2026-03-14 18:51:01 +08:00
parent 549f0cb460
commit 633b84009c

View File

@@ -40,7 +40,7 @@ import (
// versionMatcher defines a variable matcher to be parsed by the router
// when a request is about to be served.
const versionMatcher = "/v{version:[0-9.]+(-dirty)?}"
const versionMatcher = "/v{version:[0-9.]+(?:-dirty)?}"
// Config provides the configuration for the API server
type Config struct {