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

Turn off following symlinks #2195

Open
kmkacpermajor opened this issue Jul 26, 2024 Discussed in #2194 · 2 comments
Open

Turn off following symlinks #2195

kmkacpermajor opened this issue Jul 26, 2024 Discussed in #2194 · 2 comments

Comments

@kmkacpermajor
Copy link

Discussed in #2194

Originally posted by kmkacpermajor July 25, 2024
Hi,
Is it possible to turn off following symlinks in gomplate.config?

I have all files excluded except for !*.tmpl, and it still tries to follow symlinks (even though their names don't end with .tmpl).
Because files that symlinks should follow don't exist on my computer, gomplate ends with an error "failed to gather templates for rendering: walkDir: ignore matching failed for ../..: applyPatterns: stat: stat testSymlink: no such file or directory".

I can't seem to find an option to turn off following symlinks in gomplate.

If there would be a config option to change os.Stat() to os.Lstat(), it would be great.
It would read the information off of symlink, and then for my usage it would just be excluded.

@hairyhenderson
Copy link
Owner

@kmkacpermajor thanks for filing this - can you provide some more concrete details? what exactly does your configuration and/or gomplate commandline look like?

@kmkacpermajor
Copy link
Author

kmkacpermajor commented Jul 26, 2024

Sure,
To recreate this:

  • touch test_file
  • ln -s test_file test_link
  • rm test_file
  • create gomplate.config (below)
  • gomplate --config gomplate.config

Error: failed to gather templates for rendering: walkDir: ignore matching failed for.: applyPatterns: stat: stat test_link: no such file or directory.

gomplate.config

excludes:
  - '*'
  - '!*.tmpl'

inputDir: .

outputMap:  |
  {{ .in | strings.ReplaceAll ".tmpl" "" }}

I'm on Ubuntu 22.04.1 LTS on WSL2, gomplate v4.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants