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

Alt licence #9

Merged
merged 5 commits into from
Dec 31, 2016
Merged

Alt licence #9

merged 5 commits into from
Dec 31, 2016

Conversation

jspc
Copy link
Contributor

@jspc jspc commented Dec 30, 2016

From https://www.reddit.com/r/golang/comments/5l3i9b/deliver_go_binaries_as_fast_and_easy_as_possible/dbss8t5/

This PR introduces expansion of the default files to add code in config.go's fix() function.

The original rationale behind this change is to allow the tool to recognise and use the alternative spelling of 'Licence' that Real English ™️ uses. The scope has crept a little in that the original implementation would bail when no licence was included.

I have also expanded the testing of this method; it had happy-path'd file selection a tad.

"LICENSE.md",
config.Files = []string{}

for _, f := range []string{"README.md", "LICENCE.md", "LICENSE.md"} {
Copy link
Member

Choose a reason for hiding this comment

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

I guess it would be nice to get READMEs and LICENSEs with other extensions too, so I was thinking about changing this to README.*, LICENSE.* and LICENCE.*...

What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thats not a bad idea. I think the patterns should probably be abstracted out of that function, too; it'd be more maintainable in a var statement at the top.

I'll get something going tomorrow

Copy link
Member

Choose a reason for hiding this comment

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

nice, if you can't by any reason, let me know and I work on it =)

thanks for the contribution, by the way =D

@caarlos0
Copy link
Member

refs #4

@jspc
Copy link
Contributor Author

jspc commented Dec 31, 2016

@caarlos0 ♻️

A note

https://github.com/goreleaser/releaser/pull/9/files#diff-3baf47c64847a8fb8aaa8cc2e088513bR80

This is pure laziness on my behalf to avoid writing error catchers. I'm happy to do so, but if I do I think I'm going to change fix() to use the signature and make that entire block more idiomatic.

(*ProjectConfig)func fix() error

to avoid lots of shadowing/ declaration cruft.

@nochso
Copy link

nochso commented Dec 31, 2016

Not everybody uses Markdown (especially for LICENSE files), so how about also looking for files without an extension?

I suppose it comes down to this RE: (LICEN[SC]E|README)(\.(md|txt))?

It might also be a good idea to include a CHANGELOG file.

@jspc
Copy link
Contributor Author

jspc commented Dec 31, 2016

@nochso latest commit has a naive implementation of that pattern (I didn't play much with the globbing in path/filepath so I don't know how good the pattern matching is).

EDIT: I left the suffix open: given github will (will?) support, say, README.rst (among others) I left it wildcarded.

@nochso
Copy link

nochso commented Dec 31, 2016

filepath.Match or Glob in combination with "LICENSE.*" will not match files without an extension.

@jspc
Copy link
Contributor Author

jspc commented Dec 31, 2016

Good spot; latest commit is a little more permissive.

@nochso
Copy link

nochso commented Dec 31, 2016

Good enough for me. Otherwise strings.TrimSuffix(path, filepath.Ext(path)) should work for getting the file name without any extension.

@caarlos0
Copy link
Member

Looks good, thanks!

@caarlos0 caarlos0 merged commit 5165364 into goreleaser:master Dec 31, 2016
@jspc jspc deleted the alt_lic branch December 31, 2016 11:43
@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 Nov 19, 2020
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.

None yet

3 participants