Skip to content
This repository was archived by the owner on Jan 21, 2025. It is now read-only.

Commit 15b38b8

Browse files
authored
Merge 42213e5 into 2f1c59f
2 parents 2f1c59f + 42213e5 commit 15b38b8

Some content is hidden

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

82 files changed

+67523
-407
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ jobs:
6262
- name: Linter
6363
run: |
6464
go version
65-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.56.2
66-
make lint
65+
make lint TARGET_ARCH=amd64
6766
6867
test:
6968
name: Test
@@ -79,20 +78,6 @@ jobs:
7978
steps:
8079
- name: Install dependencies
8180
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends gcc make llvm clang-16 dwz cmake curl unzip
82-
- name: Install Zydis
83-
shell: bash
84-
run: |
85-
cd /tmp
86-
git clone --depth 1 --branch v3.1.0 --recursive https://github.com/zyantific/zydis.git
87-
cd zydis
88-
rm -rf build
89-
mkdir build
90-
cd build
91-
cmake -DZYDIS_BUILD_EXAMPLES=OFF ..
92-
make -j$(nproc)
93-
sudo make install
94-
cd zycore
95-
sudo make install
9681
- name: Check out
9782
uses: actions/checkout@v4
9883
- name: Set up Go ${{matrix.go}}

.golangci.yml

Lines changed: 17 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
service:
2-
golangci-lint-version: 1.54.x
2+
golangci-lint-version: 1.60.x
33

4-
run:
5-
skip-dirs:
4+
issues:
5+
exclude-dirs:
66
- artifacts
77
- build-targets
88
- design
@@ -23,6 +23,10 @@ run:
2323
- target
2424
- virt-tests
2525
- vm-images
26+
exclude-rules:
27+
- path: hostmetadata/azure/azure.go
28+
linters:
29+
- lll
2630

2731
linters:
2832
enable-all: true
@@ -31,18 +35,19 @@ linters:
3135
# - too many non-sensical warnings
3236
# - not relevant for us
3337
# - false positives
34-
#
38+
#
3539
# "might be worth fixing" means we should investigate/fix in the mid term
3640
- containedctx # might be worth fixing
3741
- contextcheck # might be worth fixing
3842
- cyclop
3943
- depguard
4044
- dupword
4145
- durationcheck # might be worth fixing
46+
- err113
4247
- errorlint # might be worth fixing
4348
- exhaustive
44-
- exhaustivestruct
4549
- exhaustruct
50+
- forbidigo
4651
- forcetypeassert # might be worth fixing
4752
- funlen
4853
- gci # might be worth fixing
@@ -53,27 +58,23 @@ linters:
5358
- gocyclo
5459
- godot
5560
- godox # complains about TODO etc
56-
- goerr113
5761
- gofumpt
5862
- gomnd
5963
- gomoddirectives
60-
- ifshort
6164
- inamedparam
6265
- interfacebloat
6366
- ireturn
6467
- maintidx
6568
- makezero
69+
- mnd
6670
- nestif
6771
- nilerr # might be worth fixing
6872
- nilnil
6973
- nlreturn
7074
- noctx # might be worth fixing
71-
- nolintlint
7275
- nonamedreturns
73-
- nosnakecase
7476
- paralleltest
7577
- protogetter
76-
- scopelint # might be worth fixing
7778
- sqlclosecheck # might be worth fixing
7879
- tagalign
7980
- tagliatelle
@@ -85,18 +86,11 @@ linters:
8586
- wastedassign
8687
- wsl
8788
- wrapcheck
88-
- forbidigo
8989
# the following linters are deprecated
90-
- exhaustivestruct
91-
- scopelint
92-
- nosnakecase
93-
- interfacer
94-
- maligned
95-
- ifshort
96-
- structcheck # might be worth fixing
97-
- deadcode
98-
- golint
99-
- varcheck
90+
- execinquery
91+
# we don't want to change code to Go 1.22+ yet
92+
- intrange
93+
- copyloopvar
10094

10195
linters-settings:
10296
goconst:
@@ -112,22 +106,13 @@ linters-settings:
112106
disabled-checks:
113107
- dupImport # https://github.com/go-critic/go-critic/issues/845
114108
- ifElseChain
115-
- octalLiteral
116109
- whyNoLint
117-
- wrapperFunc
118110
- sloppyReassign
119111
- uncheckedInlineErr # Experimental rule with high false positive rate.
120-
121-
# Broken with Go 1.18 feature (https://github.com/golangci/golangci-lint/issues/2649):
122-
- hugeParam
123-
- rangeValCopy
124-
- typeDefFirst
125-
- paramTypeCombine
126112
gocyclo:
127113
min-complexity: 15
128114
govet:
129115
enable-all: true
130-
check-shadowing: true
131116
disable:
132117
- fieldalignment
133118
settings:
@@ -143,7 +128,7 @@ linters-settings:
143128
lll:
144129
line-length: 100
145130
tab-width: 4
146-
maligned:
147-
suggest-new: true
148131
misspell:
149132
locale: US
133+
ignore-words:
134+
- rela

Dockerfile

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,6 @@ RUN apt-get update -y && apt-get dist-upgrade -y && apt-get install -y \
88
curl wget cmake dwz lsb-release software-properties-common gnupg git clang-16 llvm \
99
golang unzip jq sudo && apt-get clean autoclean && apt-get autoremove --yes
1010

11-
RUN git clone --depth 1 --branch v3.1.0 --recursive https://github.com/zyantific/zydis.git && \
12-
cd zydis && mkdir build && cd build && \
13-
cmake -DZYDIS_BUILD_EXAMPLES=OFF .. && make -j$(nproc) && make install && \
14-
cd zycore && make install && \
15-
cd ../../.. && rm -rf zydis
16-
1711
RUN wget -qO- https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.56.2
1812

1913

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,12 @@ binary:
3434
ebpf:
3535
$(MAKE) -j$(shell nproc) -C support/ebpf
3636

37+
GOLANGCI_LINT_VERSION = "v1.60.1"
3738
lint: generate
3839
# We don't want to build the tracers here, so we stub them for linting
3940
touch support/ebpf/tracer.ebpf.x86
40-
golangci-lint run --timeout 10m
41+
go run github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION) version
42+
go run github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION) run --build-tags integration,linux --timeout 10m
4143

4244
test: generate ebpf test-deps
4345
go test ./...

config/env.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ func (e EnvironmentType) String() string {
8080
case envAzure:
8181
return "azure"
8282
case envAWS:
83-
// nolint: goconst
83+
//nolint: goconst
8484
return "aws"
8585
default:
8686
return fmt.Sprintf("unknown environment %d", e)

containermetadata/containermetadata_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ func BenchmarkGetKubernetesPodMetadata(b *testing.B) {
362362

363363
file, err := os.CreateTemp("", "test_containermetadata_cgroup*")
364364
require.NoError(b, err)
365-
defer os.Remove(file.Name()) // nolint: gocritic
365+
defer os.Remove(file.Name()) //nolint: gocritic
366366

367367
_, err = fmt.Fprintf(file,
368368
"0::/kubepods/besteffort/poda9c80282-3f6b-4d5b-84d5-a137a6668011/"+

go.mod

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,10 @@ require (
3434
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8
3535
golang.org/x/sync v0.7.0
3636
golang.org/x/sys v0.21.0
37-
google.golang.org/grpc v1.64.0
38-
google.golang.org/protobuf v1.34.1
39-
k8s.io/api v0.30.2
40-
k8s.io/apimachinery v0.30.2
41-
k8s.io/client-go v0.30.2
37+
google.golang.org/grpc v1.64.1
38+
k8s.io/api v0.30.3
39+
k8s.io/apimachinery v0.30.3
40+
k8s.io/client-go v0.30.3
4241
)
4342

4443
require (
@@ -117,14 +116,15 @@ require (
117116
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.45.0 // indirect
118117
go.opentelemetry.io/otel/metric v1.27.0 // indirect
119118
go.opentelemetry.io/otel/trace v1.27.0 // indirect
120-
golang.org/x/net v0.23.0 // indirect
119+
golang.org/x/net v0.26.0 // indirect
121120
golang.org/x/oauth2 v0.20.0 // indirect
122-
golang.org/x/term v0.18.0 // indirect
123-
golang.org/x/text v0.15.0 // indirect
121+
golang.org/x/term v0.21.0 // indirect
122+
golang.org/x/text v0.16.0 // indirect
124123
golang.org/x/time v0.3.0 // indirect
125124
google.golang.org/genproto v0.0.0-20230920204549-e6e6cdab5c13 // indirect
126125
google.golang.org/genproto/googleapis/api v0.0.0-20240513163218-0867130af1f8 // indirect
127126
google.golang.org/genproto/googleapis/rpc v0.0.0-20240513163218-0867130af1f8 // indirect
127+
google.golang.org/protobuf v1.34.1 // indirect
128128
gopkg.in/inf.v0 v0.9.1 // indirect
129129
gopkg.in/yaml.v2 v2.4.0 // indirect
130130
gopkg.in/yaml.v3 v3.0.1 // indirect

go.sum

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -310,8 +310,8 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL
310310
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
311311
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
312312
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
313-
golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs=
314-
golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
313+
golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ=
314+
golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE=
315315
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
316316
golang.org/x/oauth2 v0.20.0 h1:4mQdhULixXKP1rwYBW0vAijoXnkTG0BLCDRzfe1idMo=
317317
golang.org/x/oauth2 v0.20.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
@@ -333,12 +333,12 @@ golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBc
333333
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
334334
golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws=
335335
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
336-
golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8=
337-
golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58=
336+
golang.org/x/term v0.21.0 h1:WVXCp+/EBEHOj53Rvu+7KiT/iElMrO8ACK16SMZ3jaA=
337+
golang.org/x/term v0.21.0/go.mod h1:ooXLefLobQVslOqselCNF4SxFAaoS6KujMbsGzSDmX0=
338338
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
339339
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
340-
golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk=
341-
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
340+
golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
341+
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
342342
golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4=
343343
golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
344344
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
@@ -371,8 +371,8 @@ google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyac
371371
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
372372
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
373373
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
374-
google.golang.org/grpc v1.64.0 h1:KH3VH9y/MgNQg1dE7b3XfVK0GsPSIzJwdF617gUSbvY=
375-
google.golang.org/grpc v1.64.0/go.mod h1:oxjF8E3FBnjp+/gVFYdWacaLDx9na1aqy9oovLpxQYg=
374+
google.golang.org/grpc v1.64.1 h1:LKtvyfbX3UGVPFcGqJ9ItpVWW6oN/2XqTxfAnwRRXiA=
375+
google.golang.org/grpc v1.64.1/go.mod h1:hiQF4LFZelK2WKaP6W0L92zGHtiQdZxk8CrSdvyjeP0=
376376
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
377377
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
378378
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
@@ -401,12 +401,12 @@ gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU=
401401
gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU=
402402
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
403403
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
404-
k8s.io/api v0.30.2 h1:+ZhRj+28QT4UOH+BKznu4CBgPWgkXO7XAvMcMl0qKvI=
405-
k8s.io/api v0.30.2/go.mod h1:ULg5g9JvOev2dG0u2hig4Z7tQ2hHIuS+m8MNZ+X6EmI=
406-
k8s.io/apimachinery v0.30.2 h1:fEMcnBj6qkzzPGSVsAZtQThU62SmQ4ZymlXRC5yFSCg=
407-
k8s.io/apimachinery v0.30.2/go.mod h1:iexa2somDaxdnj7bha06bhb43Zpa6eWH8N8dbqVjTUc=
408-
k8s.io/client-go v0.30.2 h1:sBIVJdojUNPDU/jObC+18tXWcTJVcwyqS9diGdWHk50=
409-
k8s.io/client-go v0.30.2/go.mod h1:JglKSWULm9xlJLx4KCkfLLQ7XwtlbflV6uFFSHTMgVs=
404+
k8s.io/api v0.30.3 h1:ImHwK9DCsPA9uoU3rVh4QHAHHK5dTSv1nxJUapx8hoQ=
405+
k8s.io/api v0.30.3/go.mod h1:GPc8jlzoe5JG3pb0KJCSLX5oAFIW3/qNJITlDj8BH04=
406+
k8s.io/apimachinery v0.30.3 h1:q1laaWCmrszyQuSQCfNB8cFgCuDAoPszKY4ucAjDwHc=
407+
k8s.io/apimachinery v0.30.3/go.mod h1:iexa2somDaxdnj7bha06bhb43Zpa6eWH8N8dbqVjTUc=
408+
k8s.io/client-go v0.30.3 h1:bHrJu3xQZNXIi8/MoxYtZBBWQQXwy16zqJwloXXfD3k=
409+
k8s.io/client-go v0.30.3/go.mod h1:8d4pf8vYu665/kUbsxWAQ/JDBNWqfFeZnvFiVdmx89U=
410410
k8s.io/klog/v2 v2.120.1 h1:QXU6cPEOIslTGvZaXvFWiP9VKyeet3sawzTOvdXb4Vw=
411411
k8s.io/klog/v2 v2.120.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
412412
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 h1:BZqlfIlq5YbRMFko6/PM7FjZpUb45WallggurYhKGag=

hostmetadata/azure/azure.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ type IMDS struct {
8282
// Failures (missing keys, etc) are logged and ignored.
8383
//
8484
// We extract the Azure metadata according to the information at
85-
// nolint:lll
8685
// https://docs.microsoft.com/en-us/azure/virtual-machines/windows/instance-metadata-service?tabs=linux#endpoint-categories
8786
//
8887
// - 169.254.169.254 is the standard endpoint for the instance metadata service in all clouds.

hostmetadata/azure/azure_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
"github.com/stretchr/testify/require"
1616
)
1717

18-
// nolint:lll
18+
//nolint:lll
1919
const fakeAzureAnswer = `{
2020
"compute": {
2121
"azEnvironment": "AzurePublicCloud",

0 commit comments

Comments
 (0)