Check we have goimports#453
Check we have goimports#453Waldz merged 4 commits intomysteriumnetwork:masterfrom tcharding:functions
goimports#453Conversation
|
|
||
| print_success "All files are compliant to goimports." | ||
| exit 0 No newline at end of file | ||
| exit 0 |
There was a problem hiding this comment.
I couldn't seem to get an editor to edit this file without adding these 'exit 0' lines to the diff. I tried emacs and vim?
There was a problem hiding this comment.
It's ok, it's even better to have a new line at the end of the file.
There was a problem hiding this comment.
+1 that is my opinion also. I'll add the newline in a separate patch and force push.
| @@ -13,6 +13,9 @@ | |||
| #> bin/check_goimports ./communication/... | |||
|
|
|||
| source bin/helpers/output.sh | |||
There was a problem hiding this comment.
| source bin/helpers/output.sh | |
| set -e | |
| source bin/helpers/output.sh |
There was a problem hiding this comment.
missing set -e in header, so that script would fail with missing goimports or any other error
There was a problem hiding this comment.
set -e seems to be shunned by some people [1] but I see it is use widely here. Whats the ruling on this? If you guys want set -e I'll close this and do a patch adding set -e to check_goimports.
There was a problem hiding this comment.
Used this solution as advised. PR has been updated.
thanks
Currently bin/check_goimports does not end with a newline. In keeping with UNIX folklore we should have a newline on the end of a shell script file. Add newline to end of shell script file. Signed-off-by: Tobin C. Harding <me@tobin.cc>
Currently bin/check_goimports is missing `set -e` line. Add `set -e` Fixes: Issue #450 Signed-off-by: Tobin C. Harding <me@tobin.cc>
bin/check_goimportssucceeds even whengoimportsis not installed. This is because a shell variable gets set to the shell error for 'command not found'. Subsequent check on that variable is logically incorrect because of this. We can fix this by asserting we have the commandgoimportsbefore calling it.This is a reasonably common thing to do so lets add a function to
bin/helpers/to do the check. Also test the new function.Patch 1: Adds the helper function
need_cmd.Patch 2: Adds extendable test script
bin/helpers/test.shand testsneed_cmdPatch 3: Adds statement to
check_goimports:need_cmd goimportsFixes: #450
Please note: This is untested since I don't have access to the CI infrastructure. Applying this patch will cause
check_goimportsto fail ifgoimportsis not installed on the CI infrastructure (by design).Signed-off-by: Tobin C. Harding me@tobin.cc