Skip to content

feat: bump go to 1.24 and tool deps #642

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
150 changes: 67 additions & 83 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,70 +1,39 @@
service:
golangci-lint-version: 1.59.x

issues:
exclude-dirs:
- artifacts
- build-targets
- design
- docker-images
- docs
- etc
- experiments
- infrastructure
- legal
- libpf-rs
- mocks
- pf-code-indexing-service/cibackend/gomock_*
- pf-debug-metadata-service/dmsbackend/gomock_*
- pf-host-agent/support/ci-kernels
- pf-storage-backend/storagebackend/gomock_*
- scratch
- systemtests/benchmarks/_outdata
- target
- virt-tests
- vm-images

version: "2"
linters:
enable-all: true
default: all
disable:
# Disabled because of
# - too many non-sensical warnings
# - not relevant for us
# - false positives
#
# "might be worth fixing" means we should investigate/fix in the mid term
- canonicalheader
- contextcheck # might be worth fixing
- contextcheck
- copyloopvar
- cyclop
- depguard
- dupword
- err113
- errorlint # might be worth fixing
- errorlint
- exhaustive
- exhaustruct
- forbidigo
- forcetypeassert # might be worth fixing
- forcetypeassert
- funlen
- gci # might be worth fixing
- gochecknoglobals
- gochecknoinits
- gocognit
- goconst
- gocyclo
- godot
- godox # complains about TODO etc
- gofumpt
- godox
- gomoddirectives
- inamedparam
- interfacebloat
- intrange
- ireturn
- lll
- maintidx
- makezero
- mnd
- nestif
- nlreturn
- noctx # might be worth fixing
- noctx
- nonamedreturns
- paralleltest
- protogetter
Expand All @@ -74,47 +43,62 @@ linters:
- thelper
- varnamelen
- wastedassign
- wsl
- wrapcheck
# we don't want to change code to Go 1.22+ yet
- intrange
- copyloopvar

linters-settings:
goconst:
min-len: 2
min-occurrences: 2
gocritic:
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
disabled-checks:
- dupImport # https://github.com/go-critic/go-critic/issues/845
- ifElseChain
- whyNoLint
- sloppyReassign
- uncheckedInlineErr # Experimental rule with high false positive rate.

# Broken with Go 1.18 feature (https://github.com/golangci/golangci-lint/issues/2649):
- hugeParam
gocyclo:
min-complexity: 15
govet:
enable-all: true
disable:
- fieldalignment
settings:
printf: # analyzer name, run `go tool vet help` to see all analyzers
funcs: # run `go tool vet help printf` to see available settings for `printf` analyzer
- debug,debugf,debugln
- error,errorf,errorln
- fatal,fatalf,fataln
- info,infof,infoln
- log,logf,logln
- warn,warnf,warnln
- print,printf,println,sprint,sprintf,sprintln,fprint,fprintf,fprintln
misspell:
locale: US
- wsl
settings:
goconst:
min-len: 2
min-occurrences: 2
gocritic:
disabled-checks:
- dupImport
- ifElseChain
- whyNoLint
- sloppyReassign
- uncheckedInlineErr
- hugeParam
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
gocyclo:
min-complexity: 15
govet:
disable:
- fieldalignment
enable-all: true
settings:
printf:
funcs:
- debug,debugf,debugln
- error,errorf,errorln
- fatal,fatalf,fataln
- info,infof,infoln
- log,logf,logln
- warn,warnf,warnln
- print,printf,println,sprint,sprintf,sprintln,fprint,fprintf,fprintln
misspell:
locale: US
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
paths:
- third_party$
- builtin$
- examples$
formatters:
enable:
- gofmt
- goimports
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
4 changes: 3 additions & 1 deletion .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
project_name: apm-lambda-extension

version: 2

before:
hooks:
- make check-licenses
Expand All @@ -22,7 +24,7 @@ builds:

archives:
- id: zip
format: zip
formats: zip
name_template: |-
{{ .Tag }}-{{ .Os }}-{{ .Arch }}
files:
Expand Down
23 changes: 10 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
SHELL = /bin/bash -eo pipefail

GORELEASER_VERSION = "v1.19.2"
GO_LICENSER_VERSION = "v0.4.0"
GOLANGCI_LINT_VERSION = "v1.64.4"
export DOCKER_IMAGE_NAME = observability/apm-lambda-extension
export DOCKER_REGISTRY = docker.elastic.co

Expand All @@ -12,44 +9,44 @@ clean:

.PHONY: dist
dist:
@go run github.com/goreleaser/goreleaser@$(GORELEASER_VERSION) release --snapshot --clean
@go tool github.com/goreleaser/goreleaser/v2 release --snapshot --clean

.PHONY: zip
zip:
@go run github.com/goreleaser/goreleaser@$(GORELEASER_VERSION) release --snapshot --clean --skip-docker
@go tool github.com/goreleaser/goreleaser/v2 release --snapshot --clean --skip docker

build:
@go run github.com/goreleaser/goreleaser@$(GORELEASER_VERSION) build --snapshot --clean
@go tool github.com/goreleaser/goreleaser/v2 build --snapshot --clean

.PHONY: release
release:
go run github.com/goreleaser/goreleaser@$(GORELEASER_VERSION) release --clean
go tool github.com/goreleaser/goreleaser/v2 release --clean

.PHONY: release-notes
release-notes:
@./.ci/release-github.sh

.PHONY: test
test:
@go run gotest.tools/gotestsum@v1.9.0 --format testname --junitfile $(junitfile)
@go tool gotest.tools/gotestsum --format testname --junitfile $(junitfile)

.PHONY: lint-prep
lint-prep:
@go mod tidy && git diff --exit-code

.PHONY: lint
lint:
@if [ "$(CI)" != "" ]; then go run github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION) version; fi
@go run github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION) run --build-tags tools
@if [ "$(CI)" != "" ]; then go tool github.com/golangci/golangci-lint/v2/cmd/golangci-lint version; fi
@go tool github.com/golangci/golangci-lint/v2/cmd/golangci-lint run

NOTICE.txt: go.mod
@bash ./scripts/notice.sh

.PHONY: check-licenses
check-licenses:
@go run github.com/elastic/go-licenser@$(GO_LICENSER_VERSION) -d -exclude tf -exclude testing -exclude e2e-testing .
@go run github.com/elastic/go-licenser@$(GO_LICENSER_VERSION) -d -exclude tf -exclude testing -exclude e2e-testing -ext .java .
@go run github.com/elastic/go-licenser@$(GO_LICENSER_VERSION) -d -exclude tf -exclude testing -exclude e2e-testing -ext .js .
@go tool github.com/elastic/go-licenser -d -exclude tf -exclude testing -exclude e2e-testing .
@go tool github.com/elastic/go-licenser -d -exclude tf -exclude testing -exclude e2e-testing -ext .java .
@go tool github.com/elastic/go-licenser -d -exclude tf -exclude testing -exclude e2e-testing -ext .js .


.PHONY: check-notice
Expand Down
Loading
Loading