library: the market's docker volume name is compiled on first use

d3f862340 put volumeName at package level with regexp.MustCompile, so
TestNoEagerPackageRegexps was red on main on ubuntu and macOS CI from
then on (run 42784088261 at 286e3b6d5). It is lazyre.New now, like
every other package-level regexp.

Run on magpie-desktop (mote's ssh was refusing): go test -tags nogui
-run TestNoEagerPackageRegexps . ok (red at origin/main on CI), and
./internal/library ok.
This commit is contained in:
yetone
2026-11-10 17:40:35 +08:00
parent 987eac0aae
commit 7869a454cc
+3 -2
View File
@@ -1,8 +1,9 @@
package library
import (
"regexp"
"strings"
"github.com/yetone/magpie/internal/lazyre"
)
// A registry entry's runtimeArguments for an OCI package are docker run's
@@ -27,7 +28,7 @@ var dockerValued = map[string]bool{"-e": true, "--env": true, "--entrypoint": tr
"--workdir": true, "-u": true, "--user": true, "--platform": true, "--name": true, "--pull": true}
// volumeName is a named volume as docker names one.
var volumeName = regexp.MustCompile(`^[A-Za-z0-9][A-Za-z0-9_.-]*$`)
var volumeName = lazyre.New(`^[A-Za-z0-9][A-Za-z0-9_.-]*$`)
// volumeOpts are what may follow a -v's container path.
var volumeOpts = map[string]bool{"ro": true, "rw": true, "z": true, "Z": true, "nocopy": true,