aports/community/golangci-lint/APKBUILD
2025-05-17 10:48:06 +00:00

59 lines
1.9 KiB
Text

maintainer="Hoang Nguyen <folliekazetani@protonmail.com>"
pkgname=golangci-lint
pkgver=2.1.6
pkgrel=0
pkgdesc="Fast linters runner for Go"
url="https://golangci-lint.run/"
arch="all"
license="GPL-3.0-or-later"
makedepends="go"
options="net" # download Go modules
subpackages="
$pkgname-bash-completion
$pkgname-zsh-completion
$pkgname-fish-completion
"
source="$pkgname-$pkgver.tar.gz::https://github.com/golangci/golangci-lint/archive/refs/tags/v$pkgver.tar.gz"
export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"
build() {
local _goldflags="
-X main.version=$pkgver
-X main.commit=AlpineLinux
-X main.date=$(date -u "+%Y-%m-%dT%TZ" ${SOURCE_DATE_EPOCH:+-d @$SOURCE_DATE_EPOCH})
-X main.goVersion=$(go env GOVERSION)
"
go build -v -ldflags "$_goldflags" ./cmd/golangci-lint
for shell in bash fish zsh; do
./golangci-lint completion $shell > golangci-lint.$shell
done
}
check() {
# Increase the linting timeout for loongarch64 and riscv64 in each linter test case.
# The default value is 1m, if not specified.
sed -i -e 's|^\(//golangcitest:args\)|\1 --timeout=5m|g' pkg/golinters/*/testdata/*.go
# govet_fieldalignment, nilnil, nilnil_detect_opposite tests fail on 32-bit platforms
GOLANGCI_LINT_INSTALLED=true GL_TEST_RUN=1 \
go test -timeout 30m -skip '^TestFromTestdata/(govet_fieldalignment|nilnil|nilnil_detect_opposite)\.go$' ./...
}
package() {
install -Dm755 golangci-lint -t "$pkgdir"/usr/bin
install -Dm644 golangci-lint.bash \
"$pkgdir"/usr/share/bash-completion/completions/golangci-lint
install -Dm644 golangci-lint.zsh \
"$pkgdir"/usr/share/zsh/site-functions/_golangci-lint
install -Dm644 golangci-lint.fish \
"$pkgdir"/usr/share/fish/vendor_completions.d/golangci-lint.fish
}
sha512sums="
ab9a95e617eaa7f5346ac73b3857b67bef27e884bd71d453f120e9e5517c3778d64737059466a9d65632f54d5cfd954c0426cc8d04be74dcac8587537bba4f73 golangci-lint-2.1.6.tar.gz
"