Skip to content

Commit

Permalink
fix: simplify go mod tidy check (#2482)
Browse files Browse the repository at this point in the history
## Description
Adds `go mod tidy` to run before every build.
Removes script, workflow, make target, and pre-commit hook to simplify.
Adding `go mod tidy` to our build step should catch most issues with out
of sync deps.

## Checklist before merging

- [ ] Test, docs, adr added or updated as needed
- [ ] [Contributor Guide
Steps](https://github.com/defenseunicorns/zarf/blob/main/.github/CONTRIBUTING.md#developer-workflow)
followed
  • Loading branch information
lucasrod16 committed May 8, 2024
1 parent e47e50f commit 898061d
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 43 deletions.
26 changes: 0 additions & 26 deletions .github/workflows/scan-go-mod-tidy.yml

This file was deleted.

4 changes: 0 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ repos:
files: .go$
language: system
pass_filenames: true
- id: check-go-mod-tidy
name: Check for out of sync Go module dependencies
entry: make test-go-mod-tidy
language: system
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.14.0
hooks:
Expand Down
5 changes: 1 addition & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ delete-packages: ## Delete all Zarf package tarballs in the project recursively
# Note: the path to the main.go file is not used due to https://github.com/golang/go/issues/51831#issuecomment-1074188363
.PHONY: build
build: ## Build the Zarf CLI for the machines OS and architecture
go mod tidy
$(MAKE) $(BUILD_CLI_FOR_SYSTEM)

build-cli-linux-amd: ## Build the Zarf CLI for Linux on AMD64
Expand Down Expand Up @@ -220,10 +221,6 @@ test-docs-and-schema:
test-cves:
go run main.go tools sbom scan . -o json --exclude './site' --exclude './examples' | grype --fail-on low

# INTERNAL: used to test that a dev has ran `go mod tidy` in their PR
test-go-mod-tidy:
./hack/check-go-mod-tidy.sh

cve-report: ## Create a CVE report for the current project (must `brew install grype` first)
@test -d ./build || mkdir ./build
go run main.go tools sbom scan . -o json --exclude './site' --exclude './examples' | grype -o template -t hack/grype.tmpl > build/zarf-known-cves.csv
Expand Down
9 changes: 0 additions & 9 deletions hack/check-go-mod-tidy.sh

This file was deleted.

0 comments on commit 898061d

Please sign in to comment.