Newer
Older
gen() {
# Unfortunately, this is the only way to ensure go.mod and go.sum are correct.
# See https://github.com/golang/go/issues/27005
go list ./... > /dev/null
go mod tidy
fmt() {
gofmt -w -s .
go run go.coder.com/go-tools/cmd/goimports -w "-local=$(go list -m)" .
# shellcheck disable=SC2046
npx prettier \
--write \
--print-width 120 \
--no-semi \
--trailing-comma all \
--loglevel silent \
git ls-files --other --modified --exclude-standard
echo "Files need generation or are formatted incorrectly."
echo "./ci/fmt.sh"
echo
git status
exit 1
fi
}
gen
fmt
check