Skip to content
Snippets Groups Projects
Unverified Commit 7bef5008 authored by Andrew Newdigate's avatar Andrew Newdigate
Browse files

feat: add go-test pre-commit hook

Adds a pre-commit hook for go test.
parent ffb10208
No related branches found
No related tags found
No related merge requests found
Pipeline #22000753 passed
Loading
Loading
@@ -44,6 +44,15 @@
require_serial: true
stages: [commit]
 
- id: go-test
name: "go-test | common-ci-tasks"
entry: scripts/pre-commit/go-test.sh
types: [go]
language: script
description: "Run go test on project"
pass_filenames: false
stages: [commit]
- id: shellcheck
name: "shellcheck | common-ci-tasks"
description: Static analysis tool for shell scripts
Loading
Loading
Loading
Loading
@@ -56,6 +56,7 @@ repos:
- id: go-fmt # Run gofmt for changed Go files
- id: go-imports # Run go-imports for changed Go files
- id: go-mod-tidy # Run go mod tidy for changed Go files
- id: go-test # Run go test for the project if any go files have changed
- id: golangci-lint # Run golangci-lint for changed Go files
- id: shellcheck # Run shellcheck for changed Shell files
- id: shfmt # Run shellcheck for changed Shell files
Loading
Loading
#!/usr/bin/env bash
#
# Run go test
#
# This runs on all_files, since Go is better at figuring out dependencies than pre-commit
#
set -euo pipefail
IFS=$'\n\t'
eval "$(mise activate bash --shims)"
go test -short ./...
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment