Package Details: lefthook 1.6.4-1

Git Clone URL: https://aur.archlinux.org/lefthook.git (read-only, click to copy)
Package Base: lefthook
Description: git hooks manager
Upstream URL: https://github.com/evilmartians/lefthook
Licenses: MIT
Submitter: Envek
Maintainer: Envek
Last Packager: Envek
Votes: 4
Popularity: 0.168374
First Submitted: 2019-05-07 11:42 (UTC)
Last Updated: 2024-02-29 06:13 (UTC)

Dependencies (2)

Required by (1)

Sources (1)

Latest Comments

Envek commented on 2024-02-29 06:16 (UTC)

Thanks for the links! Applied build command from the current Go package guidelines.

me44ic05 commented on 2024-02-28 12:11 (UTC)

Lefthook builds started failing for me recently. Running makepkg gives the following:

flag provided but not defined: -flto
usage: link [options] main.o

I was able to fix this with the following diff

diff --git a/PKGBUILD b/PKGBUILD
index 2e36120..6b1684b 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -13,11 +13,14 @@ sha256sums=('5fbd046e2ac1c6b9b2a966ad6d174827f36e0f1dd82a20b609cb8c23a0d81632')

 build() {
   cd "$pkgname-$pkgver"
-  go build \
-    -gcflags "all=-trimpath=${PWD}" \
-    -asmflags "all=-trimpath=${PWD}" \
-    -ldflags "-extldflags ${LDFLAGS}" \
-    .
+
+  export CGO_CPPFLAGS="${CPPFLAGS}"
+  export CGO_CFLAGS="${CFLAGS}"
+  export CGO_CXXFLAGS="${CXXFLAGS}"
+  export CGO_LDFLAGS="${LDFLAGS}"
+  export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw"
+
+  go build -o .
 }

Based on the Arch Wiki's Go Package Guidelines. Seems some other packages have occasionally had similar errors and done similar things to resolve:

  1. i3keys, fix
  2. dashing, fix
  3. virtwold, fix