-
Notifications
You must be signed in to change notification settings - Fork 595
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
Add make targets for common checks + fixes #661
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
fmtcheck: | ||
"$(CURDIR)/scripts/gofmtcheck.sh" | ||
|
||
fmtfix: | ||
gofmt -w ./ | ||
|
||
vetcheck: | ||
go vet ./... | ||
|
||
copyrightcheck: | ||
go run github.com/hashicorp/copywrite@latest headers --plan | ||
|
||
copyrightfix: | ||
go run github.com/hashicorp/copywrite@latest headers | ||
|
||
check: copyrightcheck vetcheck fmtcheck | ||
|
||
fix: copyrightfix fmtfix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env bash | ||
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
if [[ -n $(gofmt -l ./) ]]; then echo "Please run gofmt -w ./ to format code"; exit 1; fi; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't help but notice that this file is itself missing a copyright header 😆 I don't know if that matters - the copywrite tool doesn't seem unhappy about it so maybe there's a global allowlist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! I don't think it matters at this point.
The reason is that the tool basically does not know how to add the header to makefiles, it's not that it would be intentionally ignored.
See https://github.com/hashicorp/copywrite/blob/0f077594eee1ea09d721a7e6fc9f07302aaff7fe/addlicense/main.go#L360-L392
Also the same issue applies to the upstream project our
copywrite
has forked, although it does have some pending PRs:To be fair there is support for
*.cmake
but I don't have enough context/knowledge to tell what that is and what's the relationship withMakefile
orGNUMakefile
and I am not quite convinced there's a value in learning that just to add the license headers. I would perceive the licensing risk with makefiles in general to be relatively low in comparison with the rest of the codebase.Feel free to correct me if I'm wrong in any of the above though!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, it seems pretty harmless to leave the Makefile un-headered!