# This file was generated by GoReleaser. DO NOT EDIT.
# Maintainer: Ciclano <ciclano@example.com>
# Maintainer: Cicrano <cicrano@example.com>
# Contributor: Fulano <fulano@example.com>
# Contributor: Beltrano <beltrano@example.com>

pkgname='test'
pkgver=0.1.3
pkgrel=1
pkgdesc='Some desc'
url='https://example.com'
arch=('x86_64' 'i686' 'aarch64' 'armv6h' 'armv7h')
license=('MIT')
provides=('test')
conflicts=('nope')
depends=('nope')
makedepends=('git')
optdepends=('nfpm')
backup=('/etc/mypkg.conf' '/var/share/mypkg')
source=("${pkgname}_${pkgver}.tar.gz::https://github.com/caarlos0/test/releases/download/v${pkgver}/test_Linux_x86_64.tar.gz")
sha256sums=('1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c67')
prepare() {
  cd "${pkgname}_${pkgver}"
  # download dependencies
  go mod download
}
build() {
  cd "${pkgname}_${pkgver}"
  export CGO_CPPFLAGS="${CPPFLAGS}"
  export CGO_CFLAGS="${CFLAGS}"
  export CGO_CXXFLAGS="${CXXFLAGS}"
  export CGO_LDFLAGS="${LDFLAGS}"
  export GOFLAGS="-buildmode=pie -trimpath -mod=readonly -modcacherw"
  go build -ldflags="-w -s -buildid='' -linkmode=external -X main.version=${pkgver}" .
  chmod +x "./${pkgname}"
}
package() {
  cd "${pkgname}_${pkgver}"
  install -Dsm755 ./goreleaser "${pkgdir}/usr/bin/goreleaser"
  mkdir -p "${pkgdir}/usr/share/bash-completion/completions/"
  mkdir -p "${pkgdir}/usr/share/zsh/site-functions/"
  mkdir -p "${pkgdir}/usr/share/fish/vendor_completions.d/"
  ./goreleaser completion bash > "${pkgdir}/usr/share/bash-completion/completions/goreleaser"
  ./goreleaser completion zsh > "${pkgdir}/usr/share/zsh/site-functions/_goreleaser"
  ./goreleaser completion fish > "${pkgdir}/usr/share/fish/vendor_completions.d/goreleaser.fish"
}
