distributable: ~

versions:
  github: encoredev/go
  strip: /^encore-go/

display-name: encore-go

provides:
  - bin/encore-go

dependencies:
  curl.se/ca-certs: '*'

warnings:
  - vendored

runtime:
  env:
    ENCORE_GOROOT: ${{prefix}}

build:
  dependencies:
    curl.se: '*'
    gnu.org/tar: '*'
  script:
    - curl -L https://github.com/encoredev/go/releases/download/encore-go{{version}}/$TYPE.tar.gz | tar zxvf -
    - run: cp -a $SRCROOT/encore-go/* .
      working-directory: ${{prefix}}
    - run: ln -s go encore-go
      working-directory: ${{prefix}}/bin
  env:
    linux/x86-64:
      TYPE: linux_x86-64
    linux/aarch64:
      TYPE: linux_arm64
    darwin/x86-64:
      TYPE: macos_x86-64
    darwin/aarch64:
      TYPE: macos_arm64

test:
  script: |
    mv $FIXTURE $FIXTURE.go
    OUTPUT=$(go run $FIXTURE.go)
    test "Hello World" = "$OUTPUT"
  fixture: |
    package main
    import "fmt"
    func main() {
      fmt.Println("Hello World")
    }
