# Maintainer: Erich Eckner # Contributor: Matthias Lisin pkgname=golangci-lint pkgdesc="Linters Runner for Go. 5x faster than gometalinter." pkgver=1.27.0 pkgrel=1 arch=('x86_64' 'pentium4' 'i686' 'i486' 'aarch64' 'armv7h' 'armv6h') url='https://github.com/golangci/golangci-lint' license=('GPL3') depends=('glibc') makedepends=('git' 'go' 'gzip') source=("${pkgname}-${pkgver}.tar.gz::https://github.com/golangci/golangci-lint/archive/v${pkgver}.tar.gz") sha256sums=('11a23b60416cab57a7d83c97d723212ec3c430c4d9fdfc698e5f5276cd5ac15a') prepare() { cd "${pkgname}-${pkgver}" go mod download } build() { local _commit _flags _commit=$(zcat "${pkgname}-${pkgver}.tar.gz" | git get-tar-commit-id) _flags=( -X=main.version=$pkgver -X=main.commit=${_commit::7} -X=main.date=$(date -u -d "@${SOURCE_DATE_EPOCH}" +'%FT%TZ') ) export CGO_CFLAGS="${CFLAGS}" export CGO_CPPFLAGS="$CPPFLAGS" export CGO_CXXFLAGS="$CXXFLAGS" export CGO_LDFLAGS="${LDFLAGS}" export GOFLAGS='-buildmode=pie -trimpath -modcacherw -mod=readonly' cd "${pkgname}-${pkgver}" go build -o "$pkgname" -ldflags="${_flags[*]}" ./cmd/"$pkgname" } package() { cd "${pkgname}-${pkgver}" install -Dm755 "$pkgname" -t "$pkgdir"/usr/bin ./"$pkgname" completion bash | install -Dm644 /dev/stdin "$pkgdir"/usr/share/bash-completion/completions/golangci-lint ./"$pkgname" completion zsh | install -Dm644 /dev/stdin "$pkgdir"/usr/share/zsh/site-functions/_golangci-lint }