# Contributor: Michał Polański <michal@polanski.me>
# Maintainer: Michał Polański <michal@polanski.me>
pkgname=gops
pkgver=0.3.28
pkgrel=7
pkgdesc="List and diagnose Go processes currently running on your system"
url="https://github.com/google/gops"
license="BSD-3-Clause"
arch="all"
makedepends="go"
subpackages="$pkgname-bash-completion $pkgname-fish-completion $pkgname-zsh-completion"
source="https://github.com/google/gops/archive/v$pkgver/gops-$pkgver.tar.gz"

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	go build

	./gops completion bash >$pkgname.bash
	./gops completion fish >$pkgname.fish
	./gops completion zsh >$pkgname.zsh
}

check() {
	go test ./...
}

package() {
	install -Dm755 $pkgname -t "$pkgdir"/usr/bin/

	install -Dm644 $pkgname.bash "$pkgdir"/usr/share/bash-completion/completions/$pkgname
	install -Dm644 $pkgname.fish "$pkgdir"/usr/share/fish/vendor_completions.d/$pkgname.fish
	install -Dm644 $pkgname.zsh "$pkgdir"/usr/share/zsh/site-functions/_$pkgname
}

sha512sums="
e9a28a47bb31ae2ac585815aaf05c1098e675f359849dc9d8e32c7feec5dc1a864ce265ff24e2f5f65bddeec51804c31ce094b0ae69b163e79e67c371a9c1e41  gops-0.3.28.tar.gz
"
