Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds gofmt checker action to GitHub workflow (#6132)
* adds gofmt checker action to GitHub workflow * gofmt applied
- Loading branch information
Showing
5 changed files
with
46 additions
and
2 deletions.
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,5 @@ | ||
FROM cytopia/gofmt | ||
|
||
COPY entrypoint.sh /entrypoint.sh | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] |
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,12 @@ | ||
name: 'Gofmt checker' | ||
description: 'Checks that all project files have been properly formatted.' | ||
inputs: | ||
path: | ||
description: 'Path to check' | ||
required: true | ||
default: './' | ||
runs: | ||
using: 'docker' | ||
image: 'Dockerfile' | ||
args: | ||
- ${{ inputs.path }} |
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,15 @@ | ||
#!/bin/sh -l | ||
set -e | ||
|
||
cd $GITHUB_WORKSPACE | ||
|
||
# Check if any files are not formatted. | ||
nonformatted="$(gofmt -l $1 2>&1)" | ||
|
||
# Return if `go fmt` passes. | ||
[ -z "$nonformatted" ] && exit 0 | ||
|
||
# Notify of issues with formatting. | ||
echo "Following files need to be properly formatted:" | ||
echo "$nonformatted" | ||
exit 1 |
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
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