Skip to content

Commit 4c10b2c

Browse files
mlguerrero12squeed
authored andcommitted
build: replace vendored dependencies with Go modules
Remove the tracked vendor directory and let Go resolve dependencies from go.mod and go.sum. Update build scripts, lint and CI configuration, and contributor and release documentation for module-based dependency management. Dependency versions remain unchanged. Fixes #1283 Signed-off-by: Marcelo Guerrero <marcegue@cisco.com>
1 parent a62f84b commit 4c10b2c

2,121 files changed

Lines changed: 12 additions & 742632 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/test.yaml‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,19 @@ jobs:
2424
with:
2525
version: v2.14.0
2626
args: -v
27-
verify-vendor:
28-
name: Verify vendor directory
27+
verify-modules:
28+
name: Verify Go modules
2929
runs-on: ubuntu-latest
3030
steps:
3131
- uses: actions/checkout@v7
3232
- name: Install Go
3333
uses: actions/setup-go@v7
3434
with:
3535
go-version-file: .github/go-version
36-
- name: Check module vendoring
36+
- name: Check Go modules
3737
run: |
38-
go mod tidy
39-
go mod vendor
40-
test -z "$(git status --porcelain)" || (echo "please run 'go mod tidy && go mod vendor', and submit your changes"; exit 1)
38+
go mod tidy -diff
39+
go mod verify
4140
build:
4241
name: Build all linux architectures
4342
needs: lint

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ _testmain.go
2525

2626
bin/
2727
gopath/
28+
/vendor/
2829
.vagrant
2930
.idea
3031
/release-*

‎.golangci.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
version: "2"
22
run:
3-
modules-download-mode: vendor
3+
modules-download-mode: readonly
44
linters:
55
enable:
66
- contextcheck

‎.yamllint.yml‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
extends: default
22

3-
ignore: |
4-
vendor
5-
63
rules:
74
document-start: disable
85
line-length: disable

‎CONTRIBUTING.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ are very busy and read the mailing lists.
3434
Each plugin is compiled simply with `go build`. Two scripts, `build_linux.sh` and `build_windows.sh`,
3535
are supplied which will build all the plugins for their respective OS.
3636

37+
Dependencies are managed with Go modules and pinned in `go.mod` and `go.sum`.
38+
Go downloads dependencies as needed; run `go mod download` to populate the module
39+
cache before building offline. Run `go mod tidy` after changing dependencies.
40+
3741
## Contribution workflow
3842

3943
This is a rough outline of how to prepare a contribution:

‎RELEASING.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Creating a new release produces the following artifacts:
1515
- Create a draft of the release note
1616
- Discuss the level of testing that's needed and create a test plan if sensible
1717
- Check what version of `go` is used in the build container, updating it if there's a new stable release.
18-
- Update the vendor directory and Godeps to pin to the corresponding containernetworking/cni release. Create a PR, makes sure it passes CI and get it merged.
18+
- Update the containernetworking/cni dependency in `go.mod` to the corresponding release and run `go mod tidy` to update `go.sum`. Create a PR, make sure it passes CI and get it merged.
1919

2020
## Creating the release artifacts
2121
1. Make sure you are on the master branch and don't have any local uncommitted changes.

‎build_linux.sh‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ if [ "$(uname)" = "Darwin" ]; then
66
export GOOS="${GOOS:-linux}"
77
fi
88

9-
export GOFLAGS="${GOFLAGS} -mod=vendor"
10-
119
mkdir -p "${PWD}/bin"
1210

1311
echo "Building plugins ${GOOS}"

‎build_windows.sh‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ cd "$(dirname "$0")"
44

55
export GO="${GO:-go}"
66
export GOOS=windows
7-
export GOFLAGS="${GOFLAGS} -mod=vendor"
87
echo "$GOFLAGS"
98

109
PLUGINS=$(cat plugins/windows_only.txt | dos2unix )

‎vendor/cyphar.com/go-pathrs/.golangci.yml‎

Lines changed: 0 additions & 43 deletions
This file was deleted.

0 commit comments

Comments
 (0)