diff options
author | Erich Eckner <git@eckner.net> | 2020-05-22 16:17:35 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2020-05-22 16:17:35 +0200 |
commit | fc7ce8d33f322a67cfb20a47e92e926f715235f4 (patch) | |
tree | 874f2cd00029784058369d5e207cfaeef2bd8451 /golangci-lint/PKGBUILD | |
parent | 27cbf8d2a89154004f5e220eb47c7a4307d27b76 (diff) | |
download | archlinuxewe.git.save-fc7ce8d33f322a67cfb20a47e92e926f715235f4.tar.xz |
golangci-lint neu
Diffstat (limited to 'golangci-lint/PKGBUILD')
-rw-r--r-- | golangci-lint/PKGBUILD | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/golangci-lint/PKGBUILD b/golangci-lint/PKGBUILD new file mode 100644 index 00000000..a100670f --- /dev/null +++ b/golangci-lint/PKGBUILD @@ -0,0 +1,52 @@ +# Maintainer: Erich Eckner <arch at eckner dot net> +# Contributor: Matthias Lisin <ml@visu.li> +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" +} + +check() { + cd "${pkgname}-${pkgver}" + # some tests build the binary and overwrite our build + chmod 555 "$pkgname" # canary + # CGO_CFLAGS break tests when run inside ~/.cache (yay). + # TODO investigate + unset CGO_CFLAGS + GL_TEST_RUN=1 GOLANGCI_LINT_INSTALLED=true go test ./... +} + +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 +} |