Skip to content

Commit

Permalink
chore: add formatting and ci tools for go (#247)
Browse files Browse the repository at this point in the history
* chore: add formatting and ci tools for go

- 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)

* fix: move commands with side-effects to setup-dev

Add also a Makefile target to run it
  • Loading branch information
fiam committed Oct 7, 2022
1 parent 70ccfbd commit b0bd559
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Makefile
Expand Up @@ -17,6 +17,9 @@ engine-dev: codegen
check-setup:
$(shell ./scripts/check-setup.sh)

setup-dev:
./scripts/setup-dev.sh

bootstrap-minio:
./scripts/minio-setup.sh

Expand All @@ -31,6 +34,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
8 changes: 8 additions & 0 deletions scripts/setup-dev.sh
@@ -0,0 +1,8 @@
#!/bin/sh

set -e

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 b0bd559

Please sign in to comment.