name: Go SDK Check

on:
  pull_request:
    branches:
      - main
    paths:
      - apps/go-sdk/**
      - .github/workflows/test-go-sdk.yml
  push:
    branches:
      - main
    paths:
      - apps/go-sdk/**
  workflow_dispatch:

jobs:
  build-and-vet:
    name: Build and Vet
    runs-on: blacksmith-4vcpu-ubuntu-2404
    if: >-
      github.event_name == 'workflow_dispatch' ||
      github.event_name == 'pull_request' ||
      (github.event_name == 'push' && github.ref == 'refs/heads/main')
    steps:
      - uses: actions/checkout@v4

      - name: Set up Go
        uses: actions/setup-go@v5
        with:
          go-version: "1.23"
          cache-dependency-path: apps/go-sdk/go.sum

      - name: Build
        working-directory: ./apps/go-sdk
        run: go build ./...

      - name: Vet
        working-directory: ./apps/go-sdk
        run: go vet ./...
