-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: add static analysis tools (#269)
* feat: add linting * fix: handle trailing ; in findParams * fix(examples): vet issue * chore: move linting to unit-tests workflow * feat: check for consistent formatting * feat: add staticcheck * fix(tests): check for unused errors SA400* * fix(tests): check errors on close (SA5001) * fix(tests): avoid calling rand.Seed * fix: don't use deprecated pb types * fix: avoid deprecated grpc.WithInsecure * fix: avoid deprecated grpc.Dial * fix(testutil): avoid using deprecated rand funcs * fix: remove deprecated spanner options * fix: some staticcheck warnings * fix: ignore field in test instead of removing * fix: improve error output * fix(testutil): remove unnecessary nil check * fix(examples): don't use deprecated type * fix(examples): additional staticcheck fixes * fix(examples/dml-batches): use short style if statement * fix: remove previously ineffective code
- Loading branch information
Showing
21 changed files
with
191 additions
and
66 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 |
---|---|---|
|
@@ -20,3 +20,49 @@ jobs: | |
uses: actions/checkout@v4 | ||
- name: Run unit tests | ||
run: go test -race -short | ||
|
||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Install Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: 1.23.x | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: vet . | ||
run: go vet ./... | ||
|
||
- name: vet ./examples | ||
working-directory: ./examples | ||
run: go vet ./... | ||
|
||
- name: vet ./benchmarks | ||
working-directory: ./benchmarks | ||
run: go vet ./... | ||
|
||
- name: gofmt | ||
run: | | ||
OUT=$(gofmt -s -d .) | ||
if [ -n "$OUT" ]; then | ||
echo -e "$OUT" | ||
echo "Code unformatted, please run 'gofmt -w -s .'" | ||
exit 1 | ||
fi | ||
- name: staticcheck . | ||
uses: dominikh/[email protected] | ||
with: | ||
version: "latest" | ||
install-go: false | ||
checks: "inherit,-U1000" | ||
working-directory: "." | ||
|
||
- name: staticcheck ./examples | ||
uses: dominikh/[email protected] | ||
with: | ||
version: "latest" | ||
install-go: false | ||
checks: "inherit,-U1000" | ||
working-directory: "./examples" |
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
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
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
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
Oops, something went wrong.