Skip to content

Commit

Permalink
Add make targets for common checks + fixes
Browse files Browse the repository at this point in the history
This is to make it easier for existing and new maintainers and contributors to run checks on the codebase.
  • Loading branch information
radeksimko committed Feb 16, 2024
1 parent a7f9ab5 commit 3cf7572
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
fmtcheck:
"$(CURDIR)/scripts/gofmtcheck.sh"

fmtfix:
gofmt -w ./

vetcheck:
go vet ./...

copyrightcheck:
go run github.com/hashicorp/copywrite@latest headers --plan

copyrightfix:
go run github.com/hashicorp/copywrite@latest headers

check: copyrightcheck vetcheck fmtcheck

fix: copyrightfix fmtfix
5 changes: 5 additions & 0 deletions scripts/gofmtcheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

if [[ -n $(gofmt -l ./) ]]; then echo "Please run gofmt -w ./ to format code"; exit 1; fi;

0 comments on commit 3cf7572

Please sign in to comment.