this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

internal/registrytest: remove _registry remnants

A while ago we changed the registrytest so it didn't assume all
contents were in the `_registry` directory, but the package itself
still contained some logic related to that, so remove it.

Signed-off-by: Roger Peppe <rogpeppe@gmail.com>
Change-Id: I51374f92d913de2c70f255b13b67a3def03b8f98
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1171678
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>

+17 -17
+4 -4
internal/registrytest/registry.go
··· 24 24 "cuelang.org/go/internal/mod/zip" 25 25 ) 26 26 27 - // New starts a registry instance that serves modules found inside the 28 - // _registry path inside fsys. It serves the OCI registry protocol. 27 + // New starts a registry instance that serves modules found inside fsys. 28 + // It serves the OCI registry protocol. 29 29 // If prefix is non-empty, all module paths will be prefixed by that, 30 30 // separated by a slash (/). 31 31 // ··· 129 129 if d.IsDir() { 130 130 return nil // we're only interested in regular files, not their parent directories 131 131 } 132 - modver, rest, ok := strings.Cut(strings.TrimPrefix(path, "_registry/"), "/") 132 + modver, rest, ok := strings.Cut(path, "/") 133 133 if !ok { 134 - return fmt.Errorf("_registry should only contain directories, but found regular file %q", path) 134 + return fmt.Errorf("registry should only contain directories, but found regular file %q", path) 135 135 } 136 136 content := modules[modver] 137 137 if content == nil {
+13 -13
internal/registrytest/testdata/simple.txtar
··· 1 - modfile example.com@v0.0.1 _registry/example.com_v0.0.1/cue.mod/module.cue 2 - modfile foo.com/bar/hello@v0.2.3 _registry/foo.com_bar_hello_v0.2.3/cue.mod/module.cue 1 + modfile example.com@v0.0.1 example.com_v0.0.1/cue.mod/module.cue 2 + modfile foo.com/bar/hello@v0.2.3 foo.com_bar_hello_v0.2.3/cue.mod/module.cue 3 3 4 - -- _registry/example.com_v0.0.1/cue.mod/module.cue -- 4 + -- example.com_v0.0.1/cue.mod/module.cue -- 5 5 module: "example.com@v0" 6 6 7 7 deps: { 8 8 "foo.com/bar/hello@v0": v: "v0.2.3" 9 9 "bar.com@v0": v: "v0.5.0" 10 10 } 11 - -- _registry/example.com_v0.0.1/top.cue -- 11 + -- example.com_v0.0.1/top.cue -- 12 12 package main 13 13 14 14 import a "foo.com/bar/hello" 15 15 a 16 16 main: "main" 17 - -- _registry/foo.com_bar_hello_v0.2.3/cue.mod/module.cue -- 17 + -- foo.com_bar_hello_v0.2.3/cue.mod/module.cue -- 18 18 module: "foo.com/bar/hello@v0" 19 19 20 20 deps: { 21 21 "bar.com@v0": v: "v0.0.2" 22 22 "baz.org@v0": v: "v0.10.1" 23 23 } 24 - -- _registry/foo.com_bar_hello_v0.2.3/x.cue -- 24 + -- foo.com_bar_hello_v0.2.3/x.cue -- 25 25 package hello 26 26 import ( 27 27 a "bar.com" ··· 30 30 "foo.com/bar/hello": "v0.2.3" 31 31 a 32 32 b 33 - -- _registry/bar.com_v0.0.2/cue.mod/module.cue -- 33 + -- bar.com_v0.0.2/cue.mod/module.cue -- 34 34 module: "bar.com@v0" 35 35 36 36 deps: "baz.org@v0": v: "v0.1.2" 37 - -- _registry/bar.com_v0.0.2/bar/x.cue -- 37 + -- bar.com_v0.0.2/bar/x.cue -- 38 38 package bar 39 39 40 40 import a "baz.org/baz" 41 41 42 42 "bar.com": "v0.0.2" 43 43 a 44 - -- _registry/baz.org_v0.10.1/cue.mod/module.cue -- 44 + -- baz.org_v0.10.1/cue.mod/module.cue -- 45 45 module: "baz.org@v0" 46 - -- _registry/baz.org_v0.10.1/baz.cue -- 46 + -- baz.org_v0.10.1/baz.cue -- 47 47 "baz.org@v0": "v0.10.1" 48 48 49 - -- _registry/baz.org_v0.1.2/cue.mod/module.cue -- 49 + -- baz.org_v0.1.2/cue.mod/module.cue -- 50 50 module: "baz.org@v0" 51 51 52 - -- _registry/bar.com_v0.5.0/cue.mod/module.cue -- 52 + -- bar.com_v0.5.0/cue.mod/module.cue -- 53 53 module: "bar.com@v0" 54 - -- _registry/bar.com_v0.5.0/bar.cue -- 54 + -- bar.com_v0.5.0/bar.cue -- 55 55 "bar.com@v0": "v0.5.0"