Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

invalid slice name error should clarify min valid length is 3 #158

Open
polarathene opened this issue Sep 11, 2024 · 1 comment
Open

invalid slice name error should clarify min valid length is 3 #158

polarathene opened this issue Sep 11, 2024 · 1 comment
Labels
good first issue Good for newcomers Simple Nice for a quick look on a minute or two

Comments

@polarathene
Copy link

This error confused me a bit at first, why was it invalid? Eventually I noticed a length of 3 characters for a slice key was successful. Looked up the source and the restriction appears to be due to a regex pattern constraint.

Perhaps in this case the error message could better indicate the failure was due to a minimum expected length?

$ chisel find --release /opt/chisel-release base-distroless
2024/09/11 04:48:18 Processing /opt/chisel-release release...
error: invalid slice name "cc" in slices/base-distroless.yaml

for sliceName, yamlSlice := range yamlPkg.Slices {
match := snameExp.FindStringSubmatch(sliceName)
if match == nil {
return nil, fmt.Errorf("invalid slice name %q in %s", sliceName, pkgPath)
}

// snameExp matches only the slice name, without the leading package name.
var snameExp = regexp.MustCompile(`^([a-z](?:-?[a-z0-9]){2,})$`)

@cjdcordeiro
Copy link
Collaborator

Thanks for suggesting this improvement @polarathene .

We'll keep this open for being picked up into our backlog ;)

@cjdcordeiro cjdcordeiro added Simple Nice for a quick look on a minute or two good first issue Good for newcomers labels Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers Simple Nice for a quick look on a minute or two
Projects
None yet
Development

No branches or pull requests

2 participants