You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
mod/module: improve error messages for bad module path
This improves the error messages when a bad module path is
encountered.
Example of former message:
invalid module name "github.com/MyUsername/MyRepoName": non-conforming path "github.com/MyUsername/MyRepoName"
Example of new message:
malformed module path "github.com/MyUsername/MyRepoName": invalid char 'M'
Fixes#3022
Signed-off-by: Roger Peppe <[email protected]>
Change-Id: I7981c69619ff33c6dda1523255c96cfb44b3e370
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1198136
Unity-Result: CUE porcuepine <[email protected]>
Reviewed-by: Daniel Martí <[email protected]>
TryBot-Result: CUEcueckoo <[email protected]>
malformed module path "github.com/foo..bar": path does not conform to OCI repository name restrictions; see https://github.com/opencontainers/distribution-spec/blob/HEAD/spec.md#pulling-manifests
importErr: `malformed import path "x./z": trailing dot in path element`,
77
77
fileErr: `malformed file path "x./z": trailing dot in path element`,
78
78
}, {
79
79
path: `.x/z`,
80
-
modErr: `leading dot in path element`,
80
+
modErr: `leading '.' in path element`,
81
81
}, {
82
82
path: `-x/z`,
83
83
modErr: `leading dash`,
84
84
importErr: `malformed import path "-x/z": leading dash`,
85
85
}, {
86
86
path: `x..y/z`,
87
-
modErr: `non-conforming path "x..y/z"`,
87
+
modErr: `path does not conform to OCI repository name restrictions; see https://github.com/opencontainers/distribution-spec/blob/HEAD/spec.md#pulling-manifests`,
88
88
}, {
89
89
path: `x.y/z/../../w`,
90
90
modErr: `invalid path element ".."`,
@@ -115,14 +115,14 @@ var checkPathTests = []checkPathTest{{
importErr: `malformed import path "bar.com/foo.": trailing dot in path element`,
471
471
fileErr: `malformed file path "bar.com/foo.": trailing dot in path element`,
472
472
}, {
473
473
path: `bar.com/_foo`,
474
-
modErr: `non-conforming path "bar.com/_foo"`,
474
+
modErr: `leading '_' in path element`,
475
475
}, {
476
476
path: `bar.com/foo___x`,
477
-
modErr: `non-conforming path "bar.com/foo___x"`,
477
+
modErr: `path does not conform to OCI repository name restrictions; see https://github.com/opencontainers/distribution-spec/blob/HEAD/spec.md#pulling-manifests`,
478
478
}, {
479
479
path: `bar.com/Sushi`,
480
-
modErr: `non-conforming path "bar.com/Sushi"`,
480
+
modErr: `invalid char 'S'`,
481
481
}, {
482
482
path: `rsc io/quote`,
483
483
modErr: `invalid char ' '`,
@@ -490,21 +490,21 @@ var checkPathTests = []checkPathTest{{
returnfmt.Errorf("path does not conform to OCI repository name restrictions; see https://github.com/opencontainers/distribution-spec/blob/HEAD/spec.md#pulling-manifests")
0 commit comments