distributable:
  url: git+https://github.com/uber-go/mock
  ref: v{{version}}

versions:
  github: uber-go/mock
  strip: /^v/

dependencies:
  go.dev: ^1.20

build:
  dependencies:
    goreleaser.com: "*"
    git-scm.org: "*"
  script: |
    goreleaser build --clean --single-target --skip=validate
    mkdir -p "{{ prefix }}"/bin
    mv dist/mock_$PLATFORM/mockgen "{{ prefix }}"/bin
  env:
    CGO_ENABLED: 0
    darwin/aarch64: {PLATFORM: darwin_arm64}
    darwin/x86-64:  {PLATFORM: darwin_amd64_v1}
    linux/aarch64:  {PLATFORM: linux_arm64}
    linux/x86-64:   {PLATFORM: linux_amd64_v1}

provides:
  - bin/mockgen

test:
  script: |
    mockgen --version | grep "v{{version}}"
    mockgen -source=foo.go -destination=foo_mock.go
    test -f foo_mock.go
