# Maintainer: kpcyrd <git@rxv.cc>
pkgname=osv-scanner
pkgver=1.6.1
pkgrel=5
pkgdesc="Vulnerability scanner written in Go which uses the data provided by https://osv.dev"
url="https://github.com/google/osv-scanner"
arch="all"
license="Apache-2.0"
makedepends="go"
checkdepends="tzdata"
options="net"
source="https://github.com/google/osv-scanner/archive/v$pkgver/osv-scanner-$pkgver.tar.gz"

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

build() {
	mkdir build
	go build -o build/ ./cmd/...
}

check() {
	# TestRun fails because more ghsa's were published since it was made
	# shellcheck disable=2046
	go test $(go list ./... | grep -v cmd/osv-scanner)
}

package() {
	install -Dm755 ./build/osv-scanner -t "$pkgdir"/usr/bin/
}

sha512sums="
b429215681a665c604445baa0cf2feb3665784a8a2497b3e17b4519714d96a9802373151912c67908d2d2f4ba84982577dfbc9a3b2a1c605d0cdb4eb18e79554  osv-scanner-1.6.1.tar.gz
"
