nfpm
nfpm copied to clipboard
Handle packaging formats with non-distinct file extensions
Is your feature request related to a problem? Please describe.
When implementing #543, I imported it into a local clone of goreleaser in order to test it. I noticed that it created a file with the .archlinux
extension. The issue is that the packager was registered as "archlinux", which I did because Arch Linux doesn't have a distinct package extension, and just uses .tar.zst
, which is the extension for any TAR file compressed with Zstandard.
Describe the solution you'd like
I think the best solution would be to add a new interface that looks something like this:
type PackagerWithExtension interface {
Packager
ConventionalExtension() string // Returns an extension like .rpm or .pkg.tar.zst
}
This way, a breaking change is avoided, while providing a type-safe way to check the extension. To check the extension, you'd do something like
if packager, ok := packager.(nfpm.PackagerWithExtension); ok {
ext := packager.ConventionalExtension()
// do something with ext
}
Describe alternatives you've considered
The ConventionalExtension()
method could be added directly to the Packager
interface, but that would be a breaking change. Also, an extension argument could be added to RegisterPackager()
, but that would be a breaking change as well.
Search
- [X] I did search for other open and closed issues before opening this.
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
Additional context
No response
I like this, as long as @caarlos0 is good with this I say add it as part of #543
I like it too, thanks for the suggestion, and feel free to do it as part of #543 if you feel like it 🙏
Should I add the ConventionalExtension()
method to all packagers as part of my PR or just Arch?
I would say probably all @Arsen6331
Done