Skip to content

Commit

Permalink
chore: properly enforce GOEXPERIMENT=loopvar to avoid stupid errors.
Browse files Browse the repository at this point in the history
The flag will be part of go 1.22.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
  • Loading branch information
FedeDP authored and poiana committed Sep 20, 2023
1 parent 5a0bda9 commit deca8f9
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 26 deletions.
2 changes: 2 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
project_name: driverkit
builds:
- id: "driverkit"
env:
- GOEXPERIMENT=loopvar
goos:
- linux
goarch:
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ driverkit_docgen ?= _output/bin/docgen
build: clean ${driverkit}

${driverkit}:
CGO_ENABLED=0 go build -v -buildmode=pie -ldflags '${LDFLAGS}' -o $@ .
CGO_ENABLED=0 GOEXPERIMENT=loopvar go build -v -buildmode=pie -ldflags '${LDFLAGS}' -o $@ .

.PHONY: release
release: clean
Expand Down Expand Up @@ -100,8 +100,8 @@ manifest/latest:
.PHONY: test
test:
go clean -testcache
go test -v -cover -race ./...
go test -v -cover -buildmode=pie ./cmd
GOEXPERIMENT=loopvar go test -v -cover -race ./...
GOEXPERIMENT=loopvar go test -v -cover -buildmode=pie ./cmd

.PHONY: integration_test
integration_test: $(test_configs)
Expand Down
46 changes: 23 additions & 23 deletions pkg/driverbuilder/builder/ubuntu_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,17 +147,17 @@ var tests = []struct {
},
{
config: kernelrelease.KernelRelease{
Fullversion: "6.3.0",
Fullversion: "6.5.0",
Version: semver.Version{
Major: 6,
Minor: 3,
Minor: 5,
Patch: 0,
},
Extraversion: "7",
FullExtraversion: "-7",
Extraversion: "5",
FullExtraversion: "-5",
Architecture: kernelrelease.ArchitectureAmd64,
},
kernelversion: "7",
kernelversion: "5",
expected: struct {
headersURLs []string
urls []string
Expand All @@ -167,31 +167,31 @@ var tests = []struct {
err error
}{
headersURLs: []string{
"https://mirrors.edge.kernel.org/ubuntu/pool/main/l/linux/linux-headers-6.3.0-7-generic_6.3.0-7.7_amd64.deb",
"https://mirrors.edge.kernel.org/ubuntu/pool/main/l/linux/linux-headers-6.3.0-7_6.3.0-7.7_all.deb",
"https://mirrors.edge.kernel.org/ubuntu/pool/main/l/linux/linux-headers-6.5.0-5-generic_6.5.0-5.5_amd64.deb",
"https://mirrors.edge.kernel.org/ubuntu/pool/main/l/linux/linux-headers-6.5.0-5_6.5.0-5.5_all.deb",
},
urls: []string{
"https://mirrors.edge.kernel.org/ubuntu/pool/main/l/linux/linux-headers-6.3.0-7_6.3.0-7.7_amd64_all.deb",
"https://mirrors.edge.kernel.org/ubuntu/pool/main/l/linux/linux-headers-6.3.0-7-generic_6.3.0-7.7_amd64.deb",
"https://mirrors.edge.kernel.org/ubuntu/pool/main/l/linux/linux-generic-headers-6.3.0-7_6.3.0-7.7_all.deb",
"https://mirrors.edge.kernel.org/ubuntu/pool/main/l/linux/linux-headers-6.3.0-7_6.3.0-7.7_amd64.deb",
"https://mirrors.edge.kernel.org/ubuntu/pool/main/l/linux/linux-headers-6.3.0-7_6.3.0-7.7_all.deb",
"https://mirrors.edge.kernel.org/ubuntu/pool/main/l/linux-generic/linux-headers-6.3.0-7_6.3.0-7.7_amd64_all.deb",
"https://mirrors.edge.kernel.org/ubuntu/pool/main/l/linux-generic/linux-headers-6.3.0-7-generic_6.3.0-7.7_amd64.deb",
"https://mirrors.edge.kernel.org/ubuntu/pool/main/l/linux-generic/linux-generic-headers-6.3.0-7_6.3.0-7.7_all.deb",
"https://mirrors.edge.kernel.org/ubuntu/pool/main/l/linux-generic/linux-headers-6.3.0-7_6.3.0-7.7_amd64.deb",
"https://mirrors.edge.kernel.org/ubuntu/pool/main/l/linux-generic/linux-headers-6.3.0-7_6.3.0-7.7_all.deb",
"https://mirrors.edge.kernel.org/ubuntu/pool/main/l/linux-generic-6.3/linux-headers-6.3.0-7_6.3.0-7.7_amd64_all.deb",
"https://mirrors.edge.kernel.org/ubuntu/pool/main/l/linux-generic-6.3/linux-headers-6.3.0-7-generic_6.3.0-7.7_amd64.deb",
"https://mirrors.edge.kernel.org/ubuntu/pool/main/l/linux-generic-6.3/linux-generic-headers-6.3.0-7_6.3.0-7.7_all.deb",
"https://mirrors.edge.kernel.org/ubuntu/pool/main/l/linux-generic-6.3/linux-headers-6.3.0-7_6.3.0-7.7_amd64.deb",
"https://mirrors.edge.kernel.org/ubuntu/pool/main/l/linux-generic-6.3/linux-headers-6.3.0-7_6.3.0-7.7_all.deb",
"https://mirrors.edge.kernel.org/ubuntu/pool/main/l/linux/linux-headers-6.5.0-5_6.5.0-5.5_amd64_all.deb",
"https://mirrors.edge.kernel.org/ubuntu/pool/main/l/linux/linux-headers-6.5.0-5-generic_6.5.0-5.5_amd64.deb",
"https://mirrors.edge.kernel.org/ubuntu/pool/main/l/linux/linux-generic-headers-6.5.0-5_6.5.0-5.5_all.deb",
"https://mirrors.edge.kernel.org/ubuntu/pool/main/l/linux/linux-headers-6.5.0-5_6.5.0-5.5_amd64.deb",
"https://mirrors.edge.kernel.org/ubuntu/pool/main/l/linux/linux-headers-6.5.0-5_6.5.0-5.5_all.deb",
"https://mirrors.edge.kernel.org/ubuntu/pool/main/l/linux-generic/linux-headers-6.5.0-5_6.5.0-5.5_amd64_all.deb",
"https://mirrors.edge.kernel.org/ubuntu/pool/main/l/linux-generic/linux-headers-6.5.0-5-generic_6.5.0-5.5_amd64.deb",
"https://mirrors.edge.kernel.org/ubuntu/pool/main/l/linux-generic/linux-generic-headers-6.5.0-5_6.5.0-5.5_all.deb",
"https://mirrors.edge.kernel.org/ubuntu/pool/main/l/linux-generic/linux-headers-6.5.0-5_6.5.0-5.5_amd64.deb",
"https://mirrors.edge.kernel.org/ubuntu/pool/main/l/linux-generic/linux-headers-6.5.0-5_6.5.0-5.5_all.deb",
"https://mirrors.edge.kernel.org/ubuntu/pool/main/l/linux-generic-6.5/linux-headers-6.5.0-5_6.5.0-5.5_amd64_all.deb",
"https://mirrors.edge.kernel.org/ubuntu/pool/main/l/linux-generic-6.5/linux-headers-6.5.0-5-generic_6.5.0-5.5_amd64.deb",
"https://mirrors.edge.kernel.org/ubuntu/pool/main/l/linux-generic-6.5/linux-generic-headers-6.5.0-5_6.5.0-5.5_all.deb",
"https://mirrors.edge.kernel.org/ubuntu/pool/main/l/linux-generic-6.5/linux-headers-6.5.0-5_6.5.0-5.5_amd64.deb",
"https://mirrors.edge.kernel.org/ubuntu/pool/main/l/linux-generic-6.5/linux-headers-6.5.0-5_6.5.0-5.5_all.deb",
},
gccVersion: semver.Version{
Major: 6,
Minor: 3,
},
firstExtra: "7",
firstExtra: "5",
flavor: "generic",
err: nil,
},
Expand Down

0 comments on commit deca8f9

Please sign in to comment.