This commit is contained in:
Jacob Heider 2024-05-25 14:22:10 -04:00 committed by Jacob Heider
parent 80e86a2430
commit 5c14cca70b

View file

@ -0,0 +1,33 @@
distributable:
url: https://github.com/mvdan/sh/archive/refs/tags/{{ version.tag }}.tar.gz
strip-components: 1
versions:
github: mvdan/sh
provides:
- bin/shfmt
build:
dependencies:
go.dev: ^1.21
script:
- go mod download
- go build -v -trimpath -ldflags="$GO_LDFLAGS" -o '{{prefix}}/bin/shfmt' ./cmd/shfmt
env:
GO_LDFLAGS:
- -s
- -w
- -X main.version=v{{version}}
linux:
# or segmentation fault
# fix found here https://github.com/docker-library/golang/issues/402#issuecomment-982204575
LDFLAGS:
- -buildmode=pie
test:
- test "$(shfmt --version)" = "v{{version}}"
- run: test "$(echo 'echo "hello world"; echo 42' | shfmt)" = "$(cat $FIXTURE)"
fixture: |
echo "hello world"
echo 42