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

feat: Directory content type with custom attributes #390

Merged
merged 22 commits into from
Nov 12, 2021

Conversation

erikgeiser
Copy link
Member

This PR introduces the content type dir which can be used to add empty directories or directories with custom attributes such as owner, group or permissions. It also makes EmptyFolders obsolete.

Another important aspect is that it can be used to specified directories "owned" by the package when packaging RPMs as only those directories are removed when the package is uninstalled. This use case is also now well documented.

@pull-request-size pull-request-size bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Nov 3, 2021
@vercel vercel bot temporarily deployed to Preview November 3, 2021 21:31 Inactive
@codecov
Copy link

codecov bot commented Nov 3, 2021

Codecov Report

Merging #390 (4e94df1) into master (e05fb50) will increase coverage by 0.53%.
The diff coverage is 75.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #390      +/-   ##
==========================================
+ Coverage   64.71%   65.25%   +0.53%     
==========================================
  Files          14       14              
  Lines        1828     1842      +14     
==========================================
+ Hits         1183     1202      +19     
+ Misses        509      502       -7     
- Partials      136      138       +2     
Impacted Files Coverage Δ
nfpm.go 80.72% <18.75%> (-5.64%) ⬇️
files/files.go 88.97% <78.78%> (-6.48%) ⬇️
deb/deb.go 68.90% <80.76%> (+2.65%) ⬆️
apk/apk.go 71.81% <81.48%> (+3.29%) ⬆️
rpm/rpm.go 69.05% <84.78%> (-1.02%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e05fb50...4e94df1. Read the comment docs.

@@ -166,7 +165,7 @@ func (*Deb) SetPackagerDefaults(info *nfpm.Info) {
// if in the long run we should be more strict about this and error when
// not set?
if info.Maintainer == "" {
log.Println("DEPRECATION WARNING: Leaving the 'maintainer' field unset will not be allowed in a future version")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't use log, elsewhere, so I changed it to print to os.Stderr just like the empty_folders deprecation warning.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thinking out loud here: maybe we could allow the caller to pass a io.Writer or some other interface as to "where should we print the warnings" 🤔

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's a good idea for another PR with some mechanism for deprecation warnings. I would leave it out of this one, though.

Copy link
Member Author

@erikgeiser erikgeiser Nov 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another idea: a package level io.Writer for warnings that defaults to os.Stderr that can be overwritten globally. It's simple enough to add it to this PR.

Copy link
Contributor

@djgilcrease djgilcrease left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vercel vercel bot temporarily deployed to Preview November 4, 2021 19:18 Inactive
@vercel vercel bot temporarily deployed to Preview November 4, 2021 19:43 Inactive
@vercel vercel bot temporarily deployed to Preview November 5, 2021 20:37 Inactive
@vercel vercel bot temporarily deployed to Preview November 6, 2021 18:05 Inactive
@erikgeiser erikgeiser changed the title Feature: Directory content type with custom attributes feat: Directory content type with custom attributes Nov 7, 2021
@vercel vercel bot temporarily deployed to Preview November 7, 2021 14:07 Inactive
Copy link
Member

@caarlos0 caarlos0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just some nitpicks, but looks good overall!

awesome work!

@@ -166,7 +165,7 @@ func (*Deb) SetPackagerDefaults(info *nfpm.Info) {
// if in the long run we should be more strict about this and error when
// not set?
if info.Maintainer == "" {
log.Println("DEPRECATION WARNING: Leaving the 'maintainer' field unset will not be allowed in a future version")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thinking out loud here: maybe we could allow the caller to pass a io.Writer or some other interface as to "where should we print the warnings" 🤔

Co-authored-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
@vercel vercel bot temporarily deployed to Preview November 8, 2021 18:34 Inactive
@vercel vercel bot temporarily deployed to Preview November 8, 2021 18:38 Inactive
@vercel vercel bot temporarily deployed to Preview November 8, 2021 18:40 Inactive
@caarlos0 caarlos0 merged commit 4f53621 into goreleaser:master Nov 12, 2021
@caarlos0
Copy link
Member

awesome work as always, thanks @erikgeiser !

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants