Skip to content
This repository was archived by the owner on Sep 29, 2025. It is now read-only.

Conversation

@erharb
Copy link
Owner

@erharb erharb commented Oct 2, 2023

Not quite successful run using gomplate in-place.

Desired

  • Files with ".tmpl" extension renamed, overwriting files of that new name where present (e.g. README.md.tmpl in place of README.md).
  • Folders/file names with substitution values in them should be removed (e.g. /packaging/{{{{.data.Name}}}})
  • Folders/files found in .gomplateignore should be removed.
    • Note that .git folder needs to stick around also, but removal of it from .gomplateignore may have caused git index errors...

Actual

  • Files with ".tmpl" extension were not renamed where file of new name are present.
  • Folders/file names with substitution values in them are kept alongside their renamed counterparts.
  • Folders/files found in .gomplateignore are kept alongside templatized folders/files.

Command output

Commands run against current contents of main branch in this project:

$ gomplate --verbose
16:46:23 DBG using config file cfgFile=.gomplate.yaml
16:46:23 DBG starting gomplate
16:46:23 DBG config is:
---
context:
  data:
    header: {}
    url: file:///Users/foo/git-pub/tmp-gomplatized-in-place/skeleton-data.yaml
inputDir: ./
outputMap: |
  ./{{{{ .in | tmpl.Inline | strings.ReplaceAll ".tmpl" "" }}}}
leftDelim: '{{{{'
rightDelim: '}}}}'
 build=HEAD version=0.0.0
16:46:23 DBG completed rendering duration=0.005588833 errors=0 templatesRendered=12

$ git add -A

$ git status
On branch test-in-place
Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
	modified:   README.md
	new file:   packaging/foo-repo/package.yaml

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant