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: replace zglob with fileglob #1889

Merged
merged 12 commits into from Nov 10, 2020
Merged

feat: replace zglob with fileglob #1889

merged 12 commits into from Nov 10, 2020

Conversation

caarlos0
Copy link
Member

@caarlos0 caarlos0 commented Nov 5, 2020

BREAKING CHANGE: may have unintended side-effects.

so we can be consistent and have a single glob dependency, as per goreleaser/nfpm#244


one case that came out of this is, imagine a tree like:

.
- foo
  - bar.txt
- zap.txt

and a glob ./**/*.txt.

On the previous glob library it would return both txt files, now it will only return bar.txt, which I think is correct, since the ./**/ implies that it should be in a subfolder.

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
@vercel
Copy link

vercel bot commented Nov 5, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/goreleaser/goreleaser/96j3jwue0
✅ Preview: https://goreleaser-git-glob.goreleaser.now.sh

@caarlos0 caarlos0 self-assigned this Nov 5, 2020
@pull-request-size pull-request-size bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 5, 2020
@caarlos0 caarlos0 added automerge enhancement New feature or request and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 5, 2020
@caarlos0 caarlos0 changed the title fix: replace zglob with gobwas/glob feat: replace zglob with gobwas/glob Nov 5, 2020
@pull-request-size pull-request-size bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 5, 2020
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
@vercel vercel bot temporarily deployed to Preview November 5, 2020 22:17 Inactive
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
@vercel vercel bot temporarily deployed to Preview November 5, 2020 22:27 Inactive
@djgilcrease
Copy link

LGTM, but quick question on why not use https://golang.org/pkg/path/filepath/#Glob

@erikgeiser
Copy link
Member

Previously zglob was used which allows for zsh-style globs. If users use these additional features their packages won't build with filepath/glob.

@erikgeiser
Copy link
Member

I can review this PR later today.

Copy link
Member

@radeksimko radeksimko left a comment

Choose a reason for hiding this comment

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

Looks like @djgilcrease already asked the question I would also asked and @erikgeiser answered it, so I don't have much to add here.

As for the breaking change - I would certainly call it out in the changelog and will defer to your decision about versioning or any other impact.

FWIW I would usually judge the severity (who would be impacted) based on how reasonable the previous behaviour/expectation was. As you mentioned the ./**/*.txt behaviour currently just seems wrong anyway, so not a huge deal in my opinion. 🤷 In fact I would even go as far as documenting it as a bug fix (alongside the "breaking change" entry in the changelog).

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
@vercel vercel bot temporarily deployed to Preview November 7, 2020 00:56 Inactive
@caarlos0
Copy link
Member Author

caarlos0 commented Nov 7, 2020

depends on goreleaser/fileglob#2

@vercel vercel bot temporarily deployed to Preview November 7, 2020 00:56 Inactive
@@ -157,8 +157,6 @@ func TestRunPipe(t *testing.T) {
t,
[]string{
fmt.Sprintf("README.%s.md", os),
"foo/bar",
Copy link
Member Author

Choose a reason for hiding this comment

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

not sure if this was wrong before or if it is wrong now...

Copy link
Member Author

Choose a reason for hiding this comment

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

as far as I tested, archives still work ok even if missing the "dirs"...

@@ -163,8 +163,6 @@ func TestRunPipeWithIDsThenFilters(t *testing.T) {
require.True(t, client.UploadedFile)
require.Contains(t, client.UploadedFileNames, "bin.deb")
require.Contains(t, client.UploadedFileNames, "bin.tar.gz")
require.Contains(t, client.UploadedFileNames, "release1.golden")
Copy link
Member Author

Choose a reason for hiding this comment

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

this was wrong before...

@@ -426,7 +424,7 @@ func TestRunPipeInvalidGlob(t *testing.T) {
"ID": "default",
},
})
require.EqualError(t, Pipe{}.Run(ctx), `failed to find files to archive: globbing failed for pattern [x-]: file does not exist`)
require.EqualError(t, Pipe{}.Run(ctx), `failed to find files to archive: globbing failed for pattern [x-]: unexpected end of input`)
Copy link
Member Author

Choose a reason for hiding this comment

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

better errors 🙏

@caarlos0 caarlos0 removed the automerge label Nov 8, 2020
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
@vercel vercel bot temporarily deployed to Preview November 8, 2020 00:14 Inactive
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
@vercel vercel bot temporarily deployed to Preview November 8, 2020 17:07 Inactive
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
@pull-request-size pull-request-size bot removed the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 8, 2020
@vercel vercel bot temporarily deployed to Preview November 8, 2020 17:23 Inactive
@pull-request-size pull-request-size bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 8, 2020
@vercel vercel bot temporarily deployed to Preview November 8, 2020 17:29 Inactive
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
@codecov
Copy link

codecov bot commented Nov 8, 2020

Codecov Report

Merging #1889 (0fa1a1b) into master (c125fe3) will decrease coverage by 0.07%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1889      +/-   ##
==========================================
- Coverage   81.75%   81.67%   -0.08%     
==========================================
  Files          73       73              
  Lines        3803     3803              
==========================================
- Hits         3109     3106       -3     
- Misses        571      573       +2     
- Partials      123      124       +1     
Impacted Files Coverage Δ
internal/extrafiles/extra_files.go 66.66% <100.00%> (-20.00%) ⬇️
internal/pipe/archive/archive.go 93.37% <100.00%> (ø)

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 c125fe3...0fa1a1b. Read the comment docs.

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
@vercel vercel bot temporarily deployed to Preview November 9, 2020 22:14 Inactive
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
@vercel vercel bot temporarily deployed to Preview November 9, 2020 22:16 Inactive
@caarlos0 caarlos0 changed the title feat: replace zglob with gobwas/glob feat: replace zglob with fileglob Nov 9, 2020
@caarlos0 caarlos0 merged commit 4a6693f into master Nov 10, 2020
@caarlos0 caarlos0 deleted the glob branch November 10, 2020 14:20
@nicpottier
Copy link

Just a random note here that this change broke one of our builds silently in a way that caused an outage on production. I guess that's on us for not pinning our goreleaser version in our Github action, but this was a surprise.

@tiger5226
Copy link

tiger5226 commented Dec 16, 2020

Yeah same here, we had a low frequency deployment fail today.

failed to find files to archive: globbing failed for pattern licence*

So apparently with the new fileglob it is now searching folders zglob previously did not. In our case it was a restricted folder so it was stopped and that failed the deployment. Seems like a workaround is to set the license to something other than default so it does not search for this pattern which is the default setting.

@github-actions
Copy link
Contributor

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants