Package Details: go-swagger 0.26.1-1

Git Clone URL: https://aur.archlinux.org/go-swagger.git (read-only, click to copy)
Package Base: go-swagger
Description: Toolkit for swagger in golang (go-swagger)
Upstream URL: https://goswagger.io
Licenses: Apache
Groups: swagger
Conflicts: swagger
Provides: swagger
Submitter: casualjim
Maintainer: casualjim
Last Packager: casualjim
Votes: 2
Popularity: 0.000000
First Submitted: 2016-10-22 08:29
Last Updated: 2021-02-05 17:12

Latest Comments

matthias.lisin commented on 2021-01-20 15:17

hello again my friend. I have edited my old comment with the PKGBUILD and added some comments. The go mod download one - which I previously suggested to you without knowing better - might interest you.

matthias.lisin commented on 2020-06-18 00:39

Thanks for switching to source build! Wanted to add a few things since there were some changes since my comment.

just a suggestion I recently picked up on the mailing list:

  • you can drop the $pkg.tar.gz::$url format as Github allows to freely choose a filename of the downloaded source tag.

Explained here: github.com/ml-/pkgbuild

I maintained my own PKGBUILD for a short period of time which include all my suggestions: https://github.com/ml-/pkgbuild/blob/master/go-swagger/PKGBUILD

casualjim commented on 2020-06-17 07:35

I wanted to wait until I could do a new release. I've published a -bin package now with the binary version.

Thanks @matthias.lisin for the PKGBUILD it was helpful for providing the source build

matthias.lisin commented on 2020-05-22 11:55

Hi, can you compile the package from source, binary packages should have -bin suffix. Let me know if you need any help with the PKGBUILD.

Edit: Just did one for myself. In case you're interested:
Edit 2 (2021-01-20): Gained some knowledge and here to correct my sins. Updated the PKGBUILD, old lines commented out to keep some sort of history.

# Maintainer: Ivan Porto Carrero <ivan@flanders.co.nz> (@casualjim)
pkgname=go-swagger
pkgver=0.26.0
pkgrel=1
pkgdesc="Toolkit for swagger in golang (go-swagger)"
arch=('x86_64' 'i686' 'aarch64' 'armv6h' 'armv7h')
groups=('swagger')
provides=('swagger')
conflicts=('swagger')
url="https://goswagger.io"
license=('Apache')
depends=('glibc')
#makedepends=('git' 'go' 'gzip') # EDIT: We don't need gzip as bsdcat can do the same for us.
makedepends=('git' 'go')
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/go-swagger/go-swagger/archive/v${pkgver}.tar.gz")
sha256sums=('853ff265318249d0bbb4a4df68ade5ea1d8d0202c98f4796deb28ab2ca2fc758')

#prepare() {
#  cd "${pkgname}-${pkgver}"
#  go mod download
#}
# EDIT: `go mod download' fetches whole modules and takes longer than the other options.
#       You can remove preprare() completely or explicitly fetch the dependencies with
#       `go get -d ./cmd/swagger', which will fetch the same amount of files as
#       the implicit download via `go build'. I personally prefer to drop the prepare function.
# Comparison:
# - 140M    go-mod-download/pkg/mod/cache/download (853M unpacked)
# - 29M     go-build/pkg/mod/cache/download (132M unpacked)

build() {
  local commit_id
  #commit_id=$(zcat ${pkgname}-${pkgver}.tar.gz | git get-tar-commit-id) # EDIT: replaced zcat with bsdcat
  commit_id=$(bsdcat ${pkgname}-${pkgver}.tar.gz | git get-tar-commit-id)
  cd "${pkgname}-${pkgver}"
  export CGO_ENABLED=1
  export CGO_LDFLAGS="$LDFLAGS"
  export CGO_CFLAGS="$CFLAGS"
  export CGO_CPPFLAGS="$CPPFLAGS"
  export CGO_CXXFLAGS="$CXXFLAGS"
  export GOFLAGS='-buildmode=pie -trimpath -modcacherw -mod=readonly'

  #go build -ldflags "-X=commands.Version=v${pkgver} -X=commands.Commit=${_commit}" ./cmd/swagger
  # EDIT: -linkmode=external required for full relro
  go build -ldflags "-linkmode=external -X=...youknow" ./cmd/swagger
}

package() {
  cd "${pkgname}-${pkgver}"
  install -Dm755 swagger -t "${pkgdir}/usr/bin"
  install -Dm644 cmd/swagger/completion/swagger.bash-completion -T "${pkgdir}/usr/share/bash-completion/completions/swagger"
  install -Dm644 cmd/swagger/completion/swagger.zsh-completion -T "${pkgdir}/usr/share/zsh/site-functions/_swagger"
}

casualjim commented on 2018-06-03 17:56

The downloaded binaries are now named uniquely. It's kind of odd though that things with different hashes and the same name don't invalidate local caches.

atriix commented on 2017-12-03 12:34

Please name the download so it is unique with each version. With a aur client cache things it won't re-download new versions as is.

Something along the line of https://slexy.org/view/s21DWpXVjT