Skip to content

Commit

Permalink
Merge pull request #627 from ykulazhenkov/pr-go-mod-tidy
Browse files Browse the repository at this point in the history
Add CI check to validate that go mods and vendor dir are in sync
  • Loading branch information
adrianchiris authored Feb 12, 2024
2 parents 97e82b4 + 3c397d8 commit 08a79f7
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,22 @@ jobs:
- name: test bindata/scripts
run: make test-bindata-scripts

modules:
name: check go modules
runs-on: ubuntu-latest
steps:

- name: Set up Go 1.21
uses: actions/setup-go@v2
with:
go-version: 1.21.x

- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: check go modules are up to date
run: make check-deps

golangci:
name: Golangci-lint
runs-on: ubuntu-latest
Expand Down
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,12 @@ deps-update:
go mod tidy && \
go mod vendor

check-deps: deps-update
@set +e; git diff --quiet HEAD go.sum go.mod vendor; \
if [ $$? -eq 1 ]; \
then echo -e "\ngo modules are out of date. Please commit after running 'make deps-update' command\n"; \
exit 1; fi

$(GOLANGCI_LINT): ; $(info installing golangci-lint...)
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VER))

Expand Down
2 changes: 1 addition & 1 deletion cmd/sriov-network-config-daemon/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/golang/mock/gomock"
"github.com/spf13/cobra"
"gopkg.in/yaml.v2"
"gopkg.in/yaml.v3"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ require (
github.com/cenkalti/backoff v2.2.1+incompatible
github.com/coreos/go-systemd/v22 v22.5.0
github.com/fsnotify/fsnotify v1.7.0
github.com/go-logr/logr v1.2.4
github.com/golang/mock v1.4.4
github.com/google/go-cmp v0.6.0
github.com/hashicorp/go-retryablehttp v0.7.0
Expand Down Expand Up @@ -66,7 +67,6 @@ require (
github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d // indirect
github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32 // indirect
github.com/go-errors/errors v1.4.2 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/zapr v1.2.4 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-openapi/jsonpointer v0.20.0 // indirect
Expand Down

0 comments on commit 08a79f7

Please sign in to comment.