Skip to content

Commit

Permalink
chore: add formatting and ci tools for go
Browse files Browse the repository at this point in the history
- Install golangci-lint and gci via check-setup
- Add Makefile targets for golang-ci and golang-ci-fix. The former runs
  the same checks as CI while the latter tries to fix any errors (e.g.
  like incorrect formatting, not everything is automatically fixable)
  • Loading branch information
fiam committed Oct 7, 2022
1 parent 70ccfbd commit ca80fe1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Makefile
Expand Up @@ -31,6 +31,12 @@ test: test-go test-ts
format-templates:
pnpx prettier --write pkg/templates/assets/templates --ignore-unknown

golang-ci:
golangci-lint run

golang-ci-fix:
golangci-lint run --fix

install-proto:
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28.1

Expand Down
5 changes: 5 additions & 0 deletions scripts/check-setup.sh
Expand Up @@ -8,3 +8,8 @@ if ! [ -x "$(command -v protoc)" ]; then
echo 'curl -LO "https://github.com/protocolbuffers/protobuf/releases/download/v21.5/protoc-21.5-linux-x86_64.zip"'
exit 1
fi

if ! [ -x "$(command -v golangci-lint)" ]; then
echo "Installing golangci-lint"
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
fi

0 comments on commit ca80fe1

Please sign in to comment.