Skip to content

Commit

Permalink
Run go fmt over packages, not entire directory
Browse files Browse the repository at this point in the history
Otherwise the now persistent Go mod cache is checked as well, and builds
will fail if any dependency is not gofmt'd.

Fixes #484.
  • Loading branch information
michaelsauter committed Mar 28, 2022
1 parent cb22dae commit d79fcfc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ listed in the changelog.
- Change installation mode from centralized to local/namespaced ([#404](https://github.com/opendevstack/ods-pipeline/pull/404))
- Removed logging of test reports for TypeScript and Python build tasks ([#470](https://github.com/opendevstack/ods-pipeline/issues/470))
- Don't remove tasks on `helm` upgrades, rollbacks, etc. ([#477](https://github.com/opendevstack/ods-pipeline/issues/477))
- Run go fmt over packages, not entire directory ([#484](https://github.com/opendevstack/ods-pipeline/issues/484))

### Fixed
- Cannot enable debug mode in some tasks ([#377](https://github.com/opendevstack/ods-pipeline/issues/377))
Expand Down
3 changes: 2 additions & 1 deletion build/package/scripts/build-go.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ echo GOMODCACHE="$GOMODCACHE"
df -h "$ROOT_DIR"

echo "Checking format ..."
unformatted=$(gofmt -l .)
# shellcheck disable=SC2046
unformatted=$(go fmt $(go list ./...))
if [ -n "${unformatted}" ]; then
echo "Unformatted files:"
echo "${unformatted}"
Expand Down

0 comments on commit d79fcfc

Please sign in to comment.