distributable:
  url: https://github.com/zegl/kube-score/archive/v{{ version }}.tar.gz
  strip-components: 1

provides:
  - bin/kube-score

versions:
  github: zegl/kube-score/releases/tags

build:
  script: |
    go build -ldflags="$LDFLAGS" ./cmd/kube-score
    mkdir -p "{{ prefix }}"/bin
    mv kube-score "{{ prefix }}"/bin
  dependencies:
    go.dev: ^1.18
  env:
    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:
  kube-score version
