This repository contains submodules. Be sure to clone it with the option to include submodules. Otherwise, you will not be able to generate the protobuf code.
git clone --recurse-submodules https://github.com/dapr/durabletask-go If you already cloned the repository without --recurse-submodules, you can initialize and update the submodules with:
git submodule update --init --recursiveTo grab latest, do some variation of the following nuke your existing submodule folder then run:
rm -rf submodules/durabletask-protobuf
git submodule add --force https://github.com/dapr/durabletask-protobuf.git submodules/durabletask-protobuf
git submodule update --remote submodules/durabletask-protobufThis will initialize and update the submodules.
This project requires go v1.19.x or greater. You can build a standalone executable by simply running go build at the project root.
Use the following command to regenerate the protobuf from the submodule. Use this whenever updating the submodule reference.
# Run from the repo root and specify the output directory
# This will place the generated files directly in api/protos/, matching the go_package and your repo structure.
protoc --go_out=. --go-grpc_out=. \
-I submodules/durabletask-protobuf/protos \
submodules/durabletask-protobuf/protos/orchestrator_service.proto \
submodules/durabletask-protobuf/protos/backend_service.proto \
submodules/durabletask-protobuf/protos/runtime_state.protoFor local development with protobuf changes:
- If you have local changes to the proto files in a neighboring durabletask-protobuf directory:
# Point go.mod to your local durabletask-protobuf repo
replace github.com/dapr/durabletask-protobuf => ../durabletask-protobuf
# Regenerate protobuf files using your local proto definitions
protoc --go_out=. --go-grpc_out=. \
-I ../durabletask-protobuf/protos \
../durabletask-protobuf/protos/orchestrator_service.proto \
../durabletask-protobuf/protos/backend_service.proto \
../durabletask-protobuf/protos/runtime_state.protoThis will use your local proto files instead of the ones in the submodule, which is useful when testing protobuf changes before submitting them upstream.
Test mocks were generated using mockery. Use the following command at the project root to regenerate the mocks.
mockery --dir ./backend --name="^Backend|^Executor|^TaskWorker" --output ./tests/mocks --with-expecterAll automated tests are under ./tests. A separate test package hierarchy was chosen intentionally to prioritize black box testing. This strategy also makes it easier to catch accidental breaking API changes.
Run tests with the following command.
go test ./tests/... -coverpkg ./api,./task,./client,./backend/...,./api/helpers