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

Go Template Syntax in filenames break goreleaser #3573

Closed
3 tasks done
brumhard opened this issue Nov 18, 2022 · 4 comments
Closed
3 tasks done

Go Template Syntax in filenames break goreleaser #3573

brumhard opened this issue Nov 18, 2022 · 4 comments
Assignees
Labels
wontfix This will not be worked on

Comments

@brumhard
Copy link
Contributor

What happened?

So we're using goreleaser to release https://github.com/SchwarzIT/go-template.
The repo basically contains a template for new Go projects.
It worked fine a few months ago (latest known working version was v1.10.3). So after a while we wanted to release a new version and the pipeline now fails with version v1.12.3.

The error output is:

⨯ release failed after 1m36s               error=failed to apply template _template/api/proto/{{.Base.appName}}/v1/{{.Base.appName}}.proto: template: tmpl:1:27: executing "tmpl" at <.Base.appName>: map has no entry for key "Base"

So I guess some templating feature has been released for filenames?

How can we reproduce this?

git clone git@github.com:SchwarzIT/go-template.git
cd go-template
goreleaser release --snapshot

goreleaser version

goreleaser version 1.12.3
built by: nixpkgs
goos: darwin
goarch: arm64

https://goreleaser.com

GoReleaser Check

  • goreleaser check shows no errors

Search

  • I did search for other open and closed issues before opening this.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Additional context

No response

@brumhard brumhard added bug Something isn't working triage Issue pending triage by one of the maintainers labels Nov 18, 2022
@caarlos0
Copy link
Member


failed to apply template _template/api/proto/{{.Base.appName}}/v1/{{.Base.appName}}.proto: template: tmpl:1:27: executing "tmpl" at <.Base.appName>: map has no entry for key "Base"

I looked into your config and didn't see anything like this, but probably we added templating support to some field that didn't had it before, and now it's breaking for you because that template is not available.

Nothing we can do to fix it, you should probably replace your templates before running goreleaser.

@caarlos0 caarlos0 added wontfix This will not be worked on and removed bug Something isn't working triage Issue pending triage by one of the maintainers labels Nov 18, 2022
@caarlos0 caarlos0 closed this as not planned Won't fix, can't repro, duplicate, stale Nov 18, 2022
@brumhard
Copy link
Contributor Author

@caarlos0 the problem in this case is that the templates are part of the application and the whole folder with template syntax in the filenames should be embedded into the application to be templated when running the CLI that go-template provides. So there's no way that we can replace the templates before running goreleaser.

Would it maybe be possible to add some flag to the config to disable whatever feature that now breaks it for our usecase?
Otherwise I guess we will be stuck with v1.10.3 forever.

@caarlos0
Copy link
Member

unfortunately no.. you could probably escape the templates? For instance, using printf et al

@caarlos0
Copy link
Member

Or, a better solution, probably: create another goreleaser.yml to release the template, instead of using the same that is templated 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants