distributable:
  url: https://github.com/trufflesecurity/trufflehog/archive/refs/tags/{{version.tag}}.tar.gz
  strip-components: 1

versions:
  github: trufflesecurity/trufflehog

provides:
  - bin/trufflehog

build:
  dependencies:
    go.dev: ^1.21

  script:
    - go build -v -ldflags="$GO_LDFLAGS" -o "{{prefix}}"/bin/trufflehog

  env:
    CGO_ENABLED: 0
    GO_LDFLAGS:
      - -s
      - -w
      - -X=github.com/trufflesecurity/trufflehog/v3/pkg/version.BuildVersion={{version}}
    linux:
      GO_LDFLAGS:
        - -buildmode=pie

test: trufflehog --version 2>&1 | grep -F "{{version}}"
