From 200251fafc27059bb18e0c9ff449af0302cd82b5 Mon Sep 17 00:00:00 2001 From: Petri Hienonen Date: Sun, 4 Jan 2026 13:48:30 +0200 Subject: Add taskfile to generate protobuf --- Taskfile.yml | 37 +++++++++++++++++++++++++++++++++++++ flake.nix | 1 + 2 files changed, 38 insertions(+) create mode 100644 Taskfile.yml diff --git a/Taskfile.yml b/Taskfile.yml new file mode 100644 index 0000000..82921bc --- /dev/null +++ b/Taskfile.yml @@ -0,0 +1,37 @@ +version: "3" + +tasks: + generate: + desc: "Generate protobuf code" + cmds: + - protoc --go_out=internal/weather/pb --go_opt=paths=source_relative protos/weather.proto + + build: + desc: "Build all binaries" + cmds: + - task: generate + - go build -o bin/publisher ./cmd/publisher + - go build -o bin/subscriber ./cmd/subscriber + + run-publisher: + desc: "Run publisher with auto-generation" + cmds: + - task: generate + - go run ./cmd/publisher + + run-subscriber: + desc: "Run subscriber with auto-generation" + cmds: + - task: generate + - go run ./cmd/subscriber + + watch: + desc: "Watch and rebuild on changes" + cmds: + - task: generate + sources: + - "**/*.go" + - "**/*.proto" + generates: + - "internal/weather/pb/*.go" + method: timestamp diff --git a/flake.nix b/flake.nix index b5a4442..df03a15 100644 --- a/flake.nix +++ b/flake.nix @@ -24,6 +24,7 @@ default = pkgs.mkShell { buildInputs = with pkgs; [ go + go-task golint gopls ]; -- cgit v1.2.3-70-g09d2