Skip to content

Commit

Permalink
remove vendoring, use Go modules by default
Browse files Browse the repository at this point in the history
Removes the vendor/ directory and all vestiges of life before Go modules.

Also updates pkg/utils/testing.go to properly account for non-RHEL
systems, which typically store the pci.ids file at
/usr/share/misc/pci.ids instead of /usr/share/hwdata/pci.ids.

Issue k8snetworkplumbingwg#544

Signed-off-by: Jay Pipes <[email protected]>
  • Loading branch information
jaypipes committed Apr 16, 2024
1 parent bf5fbb6 commit 1db4ebc
Show file tree
Hide file tree
Showing 3,780 changed files with 14 additions and 1,407,570 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
run:
timeout: 3m
skip-dirs:
- vendor/
- .github/
- deployments/
- docs/
Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ ORG_PATH=github.com/k8snetworkplumbingwg
BUILDDIR=$(CURDIR)/build
REPO_PATH=$(ORG_PATH)/$(PACKAGE)
BASE=$(GOPATH)/src/$(REPO_PATH)
PKGS = $(or $(PKG),$(shell cd $(BASE) && env GOPATH=$(GOPATH) go list ./... | grep -v "^$(PACKAGE)/vendor/"))
GOFILES = $(shell find . -name *.go | grep -vE "(\/vendor\/)|(_test.go)")
PKGS = $(or $(PKG),$(shell cd $(BASE) && env GOPATH=$(GOPATH) go list ./...))
GOFILES = $(shell find . -name *.go | grep -v "_test.go")
# Test artifacts and settings
TESTPKGS = $(shell env GOPATH=$(GOPATH) go list -f '{{ if or .TestGoFiles .XTestGoFiles }}{{ .ImportPath }}{{ end }}' $(PKGS))
TIMEOUT = 15
Expand Down Expand Up @@ -117,7 +117,7 @@ test-coverage: fmt lint test-coverage-tools | $(BASE) ; $(info Running coverage
$Q cd $(BASE) && for pkg in $(TESTPKGS); do \
go test \
-coverpkg=$$(go list -f '{{ join .Deps "\n" }}' $$pkg | \
grep '^$(PACKAGE)/' | grep -v '^$(PACKAGE)/vendor/' | \
grep '^$(PACKAGE)/' | \
tr '\n' ',')$$pkg \
-covermode=$(COVERAGE_MODE) \
-coverprofile="$(COVERAGE_DIR)/coverage/`echo $$pkg | tr "/" "-"`.cover" $$pkg ;\
Expand All @@ -135,13 +135,13 @@ lint: | $(BASE) $(GOLINT) ; $(info Running golint...) @ ## Run golint on all so

.PHONY: fmt
fmt: ; $(info running gofmt...) @ ## Run gofmt on all source files
@ret=0 && for d in $$(go list -f '{{.Dir}}' ./... | grep -v /vendor/); do \
@ret=0 && for d in $$(go list -f '{{.Dir}}' ./...); do \
gofmt -l -w $$d/*.go || ret=$$? ; \
done ; exit $$ret

.PHONY: deps-update
deps-update: ; $(info Updating dependencies...) @ ## Update dependencies
@go mod tidy && go mod vendor
@go mod tidy

.PHONY: image
image: | $(BASE) ; $(info Building Docker image...) @ ## Build SR-IOV Network device plugin docker image
Expand Down
2 changes: 0 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,3 @@ require (
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)

replace github.com/gogo/protobuf => github.com/gogo/protobuf v1.3.2
13 changes: 9 additions & 4 deletions pkg/utils/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,17 @@ func (fs *FakeFilesystem) Use() func() {
panic(fmt.Errorf("error creating fake cdi directory: %s", err.Error()))
}

// TODO: Remove writing pci.ids file once ghw is mocked
// This is to fix the CI failure where ghw lib fails to
// unzip pci.ids file downloaded from internet.
// To avoid having to download the pci.ids file from the Internet on every
// workflow run, we copy a local pci.ids file into the temporary rootfs so
// ghw (and the pcidb) library can find a local copy.
pciData, err := os.ReadFile("/usr/share/hwdata/pci.ids")
if err != nil {
panic(fmt.Errorf("error reading file: %s", err.Error()))
// Debian-based systems typically store this file at
// /usr/share/misc/pci.ids
pciData, err = os.ReadFile("/usr/share/misc/pci.ids")
if err != nil {
panic(fmt.Errorf("error reading file: %s", err.Error()))
}
}
//nolint: gomnd
err = os.WriteFile(path.Join(fs.RootDir, "usr/share/hwdata/pci.ids"), pciData, 0600)
Expand Down
102 changes: 0 additions & 102 deletions vendor/github.com/Mellanox/rdmamap/.golangci.yml

This file was deleted.

12 changes: 0 additions & 12 deletions vendor/github.com/Mellanox/rdmamap/.travis.yml

This file was deleted.

201 changes: 0 additions & 201 deletions vendor/github.com/Mellanox/rdmamap/LICENSE

This file was deleted.

Loading

0 comments on commit 1db4ebc

Please sign in to comment.