# Contributor: Leonardo Arena <rnalrd@alpinelinux.org>
# Maintainer:
pkgname=go-nats
_realname=$pkgname
pkgver=1.2.2
pkgrel=0
pkgdesc="Golang client for NATS, the cloud native messaging system"
url="https://github.com/nats-io/go-nats"
arch="noarch"
license="MIT"
depends=
depends_dev=
makedepends="$depends_dev"
install=
subpackages="$pkgname-doc"
_vendor="nats-io"
source="$pkgname-$pkgver.tar.gz::https://github.com/$_vendor/$_realname/archive/v$pkgver.tar.gz"
builddir="$srcdir"/$_realname-$pkgver

prepare() {
	cd "$builddir"
}

build() {
	cd "$builddir"
}

package() {
	cd "$builddir"
	mkdir -p "$pkgdir"/usr/share/doc/$_vendor/$pkgname \
		"$pkgdir"/usr/lib/go/src/github.com/$_vendor/$_realname
	# some programs look for "nats" library
	ln -s go-nats "$pkgdir"/usr/lib/go/src/github.com/$_vendor/nats || return 1
	for file in \
		LICENSE \
		README.md \
		COPYRIGHT \
		AUTHORS \
		; do \
		test -e $file && mv $file "$pkgdir"/usr/share/doc/$_vendor/$pkgname
	done
	mv * "$pkgdir"/usr/lib/go/src/github.com/$_vendor/$_realname || return 1
}

md5sums="f96cef50172742b41dbe7485ccfb16be  go-nats-1.2.2.tar.gz"
sha256sums="e4ede33b2762ef164be9f884fa6d1ce87ba0f42730a09db0011fddcf632f2fae  go-nats-1.2.2.tar.gz"
sha512sums="c42eb0670e816f1420273975e501ced5876de75c2840a4064da047cd891d7aa6de3e9a1b2707c5e242062589fd3e71420ddd441880ebeaeb06fc844e4b7b0a86  go-nats-1.2.2.tar.gz"
