Skip to content

Commit 273602f

Browse files
committed
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 <[email protected]> Change-Id: I51374f92d913de2c70f255b13b67a3def03b8f98 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1171678 Unity-Result: CUE porcuepine <[email protected]> TryBot-Result: CUEcueckoo <[email protected]> Reviewed-by: Daniel Martí <[email protected]>
1 parent b15fcb0 commit 273602f

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

internal/registrytest/registry.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ import (
2424
"cuelang.org/go/internal/mod/zip"
2525
)
2626

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.
2929
// If prefix is non-empty, all module paths will be prefixed by that,
3030
// separated by a slash (/).
3131
//
@@ -129,9 +129,9 @@ func getModules(fsys fs.FS) (map[module.Version]*moduleContent, error) {
129129
if d.IsDir() {
130130
return nil // we're only interested in regular files, not their parent directories
131131
}
132-
modver, rest, ok := strings.Cut(strings.TrimPrefix(path, "_registry/"), "/")
132+
modver, rest, ok := strings.Cut(path, "/")
133133
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)
135135
}
136136
content := modules[modver]
137137
if content == nil {
+13-13
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
modfile [email protected] _registry/example.com_v0.0.1/cue.mod/module.cue
2-
modfile foo.com/bar/[email protected] _registry/foo.com_bar_hello_v0.2.3/cue.mod/module.cue
1+
modfile [email protected] example.com_v0.0.1/cue.mod/module.cue
2+
modfile foo.com/bar/[email protected] foo.com_bar_hello_v0.2.3/cue.mod/module.cue
33

4-
-- _registry/example.com_v0.0.1/cue.mod/module.cue --
4+
-- example.com_v0.0.1/cue.mod/module.cue --
55
module: "example.com@v0"
66

77
deps: {
88
"foo.com/bar/hello@v0": v: "v0.2.3"
99
"bar.com@v0": v: "v0.5.0"
1010
}
11-
-- _registry/example.com_v0.0.1/top.cue --
11+
-- example.com_v0.0.1/top.cue --
1212
package main
1313

1414
import a "foo.com/bar/hello"
1515
a
1616
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 --
1818
module: "foo.com/bar/hello@v0"
1919

2020
deps: {
2121
"bar.com@v0": v: "v0.0.2"
2222
"baz.org@v0": v: "v0.10.1"
2323
}
24-
-- _registry/foo.com_bar_hello_v0.2.3/x.cue --
24+
-- foo.com_bar_hello_v0.2.3/x.cue --
2525
package hello
2626
import (
2727
a "bar.com"
@@ -30,26 +30,26 @@ import (
3030
"foo.com/bar/hello": "v0.2.3"
3131
a
3232
b
33-
-- _registry/bar.com_v0.0.2/cue.mod/module.cue --
33+
-- bar.com_v0.0.2/cue.mod/module.cue --
3434
module: "bar.com@v0"
3535

3636
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 --
3838
package bar
3939

4040
import a "baz.org/baz"
4141

4242
"bar.com": "v0.0.2"
4343
a
44-
-- _registry/baz.org_v0.10.1/cue.mod/module.cue --
44+
-- baz.org_v0.10.1/cue.mod/module.cue --
4545
module: "baz.org@v0"
46-
-- _registry/baz.org_v0.10.1/baz.cue --
46+
-- baz.org_v0.10.1/baz.cue --
4747
"baz.org@v0": "v0.10.1"
4848

49-
-- _registry/baz.org_v0.1.2/cue.mod/module.cue --
49+
-- baz.org_v0.1.2/cue.mod/module.cue --
5050
module: "baz.org@v0"
5151

52-
-- _registry/bar.com_v0.5.0/cue.mod/module.cue --
52+
-- bar.com_v0.5.0/cue.mod/module.cue --
5353
module: "bar.com@v0"
54-
-- _registry/bar.com_v0.5.0/bar.cue --
54+
-- bar.com_v0.5.0/bar.cue --
5555
"bar.com@v0": "v0.5.0"

0 commit comments

Comments
 (0)