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

Files.Glob documentation unclear #1314

Open
spiriad opened this issue May 21, 2022 · 1 comment · May be fixed by #1664
Open

Files.Glob documentation unclear #1314

spiriad opened this issue May 21, 2022 · 1 comment · May be fixed by #1664

Comments

@spiriad
Copy link

spiriad commented May 21, 2022

First, https://helm.sh/docs/chart_template_guide/builtin_objects/ says:

Files.Glob is a function that returns a list of files whose names match the given shell glob pattern

Second, https://helm.sh/docs/chart_template_guide/accessing_files/#glob-patterns says:

.Glob returns a Files type, so you may call any of the Files methods on the returned object.

Also, some examples are given, one of them:

{{ range $path, $_ :=  .Files.Glob  "**.yaml" }}
      {{ $.Files.Get $path }}
{{ end }}

Third, looking at the source code https://github.com/helm/helm/blob/main/pkg/engine/files.go#L71-L88 in the Glob function doc, a similar example is given:

// {{ range $name, $content := .Files.Glob("foo/**") }}
// {{ $name }}: |
// {{ .Files.Get($name) | indent 4 }}{{ end }}

My comments are:

  1. It should be clear what Files.Glob is returning: list, map, object, etc. Each documentation page is inconsistent with the others, so much so that I had to look into the source code to determine what Files.Glob actually returns
  2. If Files.Glob returns a name:content map, why not use content directly, instead of using .Files.Get($name) like:
// {{ range $name, $content := .Files.Glob("foo/**") }}
// {{ $name }}: |
// {{ $content | toString | indent 4 }}{{ end }}
@yxxhero
Copy link
Member

yxxhero commented May 23, 2022

@adrianspiridon PR is welcome. Thanks very much.

@hickeyma hickeyma transferred this issue from helm/helm May 23, 2022
andrask pushed a commit to swisscom/helm-www that referenced this issue Dec 5, 2024
@andrask andrask linked a pull request Dec 6, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants