Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,10 @@ tasks:
generate-sqlc:
cmds:
- go run github.com/sqlc-dev/sqlc/cmd/sqlc@v1.29.0 generate --file pkg/repository/sqlcv1/sqlc.yaml
update-go-quickstart-deps:
desc: Update Go quickstart template Hatchet SDK to latest (or VERSION=vX.Y.Z)
cmds:
- bash ./hack/update-go-quickstart-deps.sh {{.VERSION | default "latest"}}
lint:
cmds:
- task: lint-go
Expand Down
2 changes: 1 addition & 1 deletion cmd/hatchet-cli/cli/templates/go/go.mod.embed
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/hatchet-dev/hatchet-go-quickstart
go 1.25.9

require (
github.com/hatchet-dev/hatchet v0.87.1
github.com/hatchet-dev/hatchet v0.88.6
github.com/joho/godotenv v1.5.1
)

Expand Down
4 changes: 2 additions & 2 deletions cmd/hatchet-cli/cli/templates/go/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+l
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k=
github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM=
github.com/hatchet-dev/hatchet v0.87.1 h1:3uzn6g+VZKwHqLII2mDwtCapweNfps2KdLMSCWafv0I=
github.com/hatchet-dev/hatchet v0.87.1/go.mod h1:mcOO2ia03lAbTdG/ubLXFNXQJPltXUmhzM0E9TV4jhU=
github.com/hatchet-dev/hatchet v0.88.6 h1:ws7EpdHLnotZN60tgspQct4NkmdDhQeKJQ/VwXaLVfU=
github.com/hatchet-dev/hatchet v0.88.6/go.mod h1:mcOO2ia03lAbTdG/ubLXFNXQJPltXUmhzM0E9TV4jhU=
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo=
Expand Down
60 changes: 60 additions & 0 deletions hack/update-go-quickstart-deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/usr/bin/env bash
# Update the Go quickstart template's Hatchet SDK dependency.
#
# The CLI stores Go template files with .embed suffixes:
# - go.mod.embed
# - *.go.embed
#
# The quickstart renderer strips that suffix when generating a user project.
# This avoids two Go toolchain issues in the Hatchet repo:
# - a real go.mod under templates/go would create a nested module boundary that
# //go:embed refuses to embed
# - real *.go files under the template directory could be treated as source
# files in the main repo
#
# Dependabot cannot update go.mod.embed because its Go module file fetcher
# discovers Go modules by looking for go.mod and go.work.
#
# This script copies the template into a temp directory, strips .embed suffixes
# to simulate the generated project, runs go get and go mod tidy there, then
# copies the updated go.mod/go.sum back into the embedded template files.
#
# Usage:
# bash hack/update-go-quickstart-deps.sh
# bash hack/update-go-quickstart-deps.sh v0.88.0

set -euo pipefail

TEMPLATE_DIR="cmd/hatchet-cli/cli/templates/go"
VERSION="${1:-latest}"

if [ ! -f "${TEMPLATE_DIR}/go.mod.embed" ]; then
echo "Error: ${TEMPLATE_DIR}/go.mod.embed not found. Run from the repo root." >&2
exit 1
fi

TMPDIR="$(mktemp -d)"
trap 'rm -rf "${TMPDIR}"' EXIT

echo "Copying template to temp directory..."
cp -a "${TEMPLATE_DIR}/." "${TMPDIR}/"

echo "Stripping .embed suffixes..."
find "${TMPDIR}" -name '*.embed' -print0 | while IFS= read -r -d '' f; do
mv "${f}" "${f%.embed}"
done

echo "Updating github.com/hatchet-dev/hatchet to ${VERSION}..."
(
cd "${TMPDIR}"
go get "github.com/hatchet-dev/hatchet@${VERSION}"
go mod tidy
)

echo "Copying updated files back..."
cp "${TMPDIR}/go.mod" "${TEMPLATE_DIR}/go.mod.embed"
cp "${TMPDIR}/go.sum" "${TEMPLATE_DIR}/go.sum"

echo "Done. Updated files:"
echo " ${TEMPLATE_DIR}/go.mod.embed"
echo " ${TEMPLATE_DIR}/go.sum"
Loading