From f71e369afa410bbc2dff31c854e1eeafe155e5bf Mon Sep 17 00:00:00 2001 From: Jahvon Dockery Date: Tue, 13 Oct 2026 01:07:20 -0400 Subject: [PATCH] chore: pin mockgen and govulncheck as go tools CI generated mocks with mockgen v0.4.0 while go.mod pins the gomock library at v0.6.0, so any machine with a newer mockgen rewrote every mock on `flow generate`. The install step only ran when a tool was missing, so a version already on the shared GOBIN was never corrected, and govulncheck was unpinned. mockgen and govulncheck are now tool directives in go.mod and run with `go tool`, so the generator always matches the library, local and CI runs use the same versions, and dependabot bumps them. Mocks are regenerated at v0.6.0. `install tools` reinstalls cobra-cli and goreleaser whenever the installed version differs from the pin, and no longer installs the unused ginkgo CLI. --- .execs/tools.flow | 32 ++-- .execs/validate.flow | 14 +- .github/workflows/ci.yaml | 2 - docs/development.md | 10 +- go.mod | 23 ++- go.sum | 44 ++++-- internal/mcp/command_executor.go | 2 +- internal/mcp/mocks/command_executor.go | 19 +-- internal/runner/engine/engine.go | 2 +- internal/runner/engine/mocks/mock_engine.go | 11 +- internal/runner/mocks/mock_runner.go | 9 +- internal/runner/runner.go | 2 +- pkg/cache/executables_cache.go | 2 +- pkg/cache/mocks/mock_executable_cache.go | 9 +- pkg/cache/mocks/mock_template_cache.go | 9 +- pkg/cache/mocks/mock_workspace_cache.go | 1 + pkg/cache/templates_cache.go | 2 +- pkg/cache/workspaces_cache.go | 2 +- pkg/store/mocks/mock_data_store.go | 161 ++++++++++---------- pkg/store/store.go | 2 +- 20 files changed, 191 insertions(+), 167 deletions(-) diff --git a/.execs/tools.flow b/.execs/tools.flow index 6f953241..65985c12 100644 --- a/.execs/tools.flow +++ b/.execs/tools.flow @@ -9,6 +9,9 @@ executables: dir: // failFast: false maxThreads: 3 + # mockgen and govulncheck are pinned as tools in go.mod and run with `go tool`, so they + # need no install. The tools below are kept out of go.mod because their dependency trees + # would leak into the module graph of anything importing pkg/. execs: - cmd: | if ! command -v go &> /dev/null; then @@ -16,22 +19,19 @@ executables: exit 1 fi - cmd: | - if ! command -v cobra-cli &> /dev/null; then - echo "cobra-cli is not installed. Installing..." - go install github.com/spf13/cobra-cli@v1.3.0 + # GOBIN is shared across repos, so a binary already on PATH may be another repo's + # version. Reinstall whenever its module version differs from the pin. + want=v1.3.0 + have=$(go version -m "$(command -v cobra-cli 2>/dev/null)" 2>/dev/null | awk '$1 == "mod" {print $3}') + if [ "$have" != "$want" ]; then + echo "Installing cobra-cli ${want} (found: ${have:-none})..." + go install github.com/spf13/cobra-cli@${want} fi - cmd: | - if ! command -v goreleaser &> /dev/null; then - echo "goreleaser is not installed. Installing..." - go install github.com/goreleaser/goreleaser/v2@v2.12.5 - fi - - cmd: | - if ! command -v ginkgo &> /dev/null; then - echo "ginkgo is not installed. Installing..." - go install github.com/onsi/ginkgo/v2/ginkgo@v2.20.2 - fi - - cmd: | - if ! command -v mockgen &> /dev/null; then - echo "mockgen is not installed. Installing..." - go install go.uber.org/mock/mockgen@v0.4.0 + # Keep in sync with the goreleaser install in .github/workflows/release.yaml. + want=v2.12.5 + have=$(go version -m "$(command -v goreleaser 2>/dev/null)" 2>/dev/null | awk '$1 == "mod" {print $3}') + if [ "$have" != "$want" ]; then + echo "Installing goreleaser ${want} (found: ${have:-none})..." + go install github.com/goreleaser/goreleaser/v2@${want} fi diff --git a/.execs/validate.flow b/.execs/validate.flow index b78d136d..2ab1c48d 100644 --- a/.execs/validate.flow +++ b/.execs/validate.flow @@ -85,22 +85,18 @@ executables: exec: dir: // cmd: | - # Without this, a failed install leaves the scan to run a missing binary and the step - # still "succeeds" — CI then fails two steps later on an empty SARIF file. + # Without this, a failed scan still lets the step "succeed" — CI then fails two steps + # later on an empty SARIF file. set -euo pipefail - if ! command -v govulncheck &> /dev/null; then - echo "Installing govulncheck..." - go install golang.org/x/vuln/cmd/govulncheck@latest - fi - + # govulncheck is pinned as a tool in go.mod, so local and CI runs use the same version. if [ "${CI:-}" = "true" ]; then # govulncheck can list the same call stack twice for a finding, and upload-sarif rejects # duplicate stacks. - govulncheck -format sarif ./... \ + go tool govulncheck -format sarif ./... \ | jq '.runs[].results[] |= (if .stacks then .stacks |= unique else . end)' > govuln.sarif echo "Security scan completed. Results saved to govuln.sarif" else - govulncheck ./... + go tool govulncheck ./... echo "Security scan completed. No vulnerabilities found." fi diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c049a9be..69206969 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -135,8 +135,6 @@ jobs: uses: actions/setup-go@v7 with: go-version-file: go.mod - - name: Install mockgen - run: go install go.uber.org/mock/mockgen@v0.4.0 # Build the flow under review and run every task with it, so CI exercises # the code as it would land on main rather than the released CLI. - name: Build flow diff --git a/docs/development.md b/docs/development.md index df6f816d..42f20962 100644 --- a/docs/development.md +++ b/docs/development.md @@ -150,13 +150,17 @@ flow build binary ./bin/flow-dev ### Required Tools -These are installed automatically by `flow install tools`: +These are installed at their pinned versions by `flow install tools`: - [cobra-cli](https://github.com/spf13/cobra-cli) - CLI scaffolding - [goreleaser](https://goreleaser.com/) - Binary builds and package distribution -- [golangci-lint](https://golangci-lint.run/) - Code linting -- [ginkgo](https://onsi.github.io/ginkgo/) - BDD testing framework + +These are pinned in `go.mod` with `tool` directives and run with `go tool`, so they need no install: + - [mockgen](https://github.com/uber-go/mock) - Generate test mocks +- [govulncheck](https://pkg.go.dev/golang.org/x/vuln/cmd/govulncheck) - Vulnerability scanning + +[golangci-lint](https://golangci-lint.run/) runs at a pinned version through `go run` in `flow lint`. ### Additional Tools diff --git a/go.mod b/go.mod index 9121bb76..c53b81cb 100644 --- a/go.mod +++ b/go.mod @@ -27,10 +27,10 @@ require ( go.etcd.io/bbolt v1.5.0 go.uber.org/mock v0.6.0 golang.org/x/exp v0.0.0-20250718183923-645b1fa84792 - golang.org/x/mod v0.41.0 - golang.org/x/sync v0.23.0 - golang.org/x/term v0.46.0 - golang.org/x/text v0.42.0 + golang.org/x/mod v0.42.0 + golang.org/x/sync v0.24.0 + golang.org/x/term v0.47.0 + golang.org/x/text v0.43.0 gopkg.in/yaml.v3 v3.0.1 mvdan.cc/sh/v3 v3.14.1 mvdan.cc/sh/x v0.0.0-20260909211640-c6351e95dbee @@ -103,8 +103,15 @@ require ( github.com/yuin/goldmark-emoji v1.0.6 // indirect github.com/zalando/go-keyring v0.2.8 // indirect go.yaml.in/yaml/v3 v3.0.5 // indirect - golang.org/x/crypto v0.55.0 // indirect - golang.org/x/net v0.58.0 // indirect - golang.org/x/sys v0.48.0 // indirect - golang.org/x/tools v0.49.0 // indirect + golang.org/x/crypto v0.58.0 // indirect + golang.org/x/net v0.61.0 // indirect + golang.org/x/sys v0.49.0 // indirect + golang.org/x/telemetry v0.0.0-20261010193011-f71dc92da45e // indirect + golang.org/x/tools v0.52.0 // indirect + golang.org/x/vuln v1.9.0 // indirect +) + +tool ( + go.uber.org/mock/mockgen + golang.org/x/vuln/cmd/govulncheck ) diff --git a/go.sum b/go.sum index 6e8caa34..f62cf271 100644 --- a/go.sum +++ b/go.sum @@ -117,12 +117,16 @@ github.com/godbus/dbus/v5 v5.2.2 h1:TUR3TgtSVDmjiXOgAAyaZbYmIeP3DPkld3jgKGV8mXQ= github.com/godbus/dbus/v5 v5.2.2/go.mod h1:3AAv2+hPq5rdnr5txxxRwiGjPXamgoIHgz9FPBfOp3c= github.com/gofrs/flock v0.13.0 h1:95JolYOvGMqeH31+FC7D2+uULf6mG61mEZ/A8dRYMzw= github.com/gofrs/flock v0.13.0/go.mod h1:jxeyy9R1auM5S6JYDBhDt+E2TCo7DkratH4Pgi8P+Z0= +github.com/google/go-cmdtest v0.4.1-0.20220921163831-55ab3332a786 h1:rcv+Ippz6RAtvaGgKxc+8FQIpxHgsF+HBzPyYL2cyVU= +github.com/google/go-cmdtest v0.4.1-0.20220921163831-55ab3332a786/go.mod h1:apVn/GCasLZUVpAJ6oWAuyP7Ne7CEsQbTnc0plM3m+o= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/jsonschema-go v0.4.2 h1:tmrUohrwoLZZS/P3x7ex0WAVknEkBZM46iALbcqoRA8= github.com/google/jsonschema-go v0.4.2/go.mod h1:r5quNTdLOYEz95Ru18zA0ydNbBuYoo9tgaYcxEYhJVE= github.com/google/pprof v0.0.0-20260402051712-545e8a4df936 h1:EwtI+Al+DeppwYX2oXJCETMO23COyaKGP6fHVpkpWpg= github.com/google/pprof v0.0.0-20260402051712-545e8a4df936/go.mod h1:MxpfABSjhmINe3F1It9d+8exIHFvUqtLIRCdOGNXqiI= +github.com/google/renameio v0.1.0 h1:GOZbcHa3HfsPKPlmyPyN2KEohoMXOhdMbHrvbpl2QaA= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/css v1.0.1 h1:ntNaBIghp6JmvWnxbZKANoLyuXTPZ4cAMlo6RyhlbO8= @@ -246,25 +250,33 @@ go.uber.org/mock v0.6.0/go.mod h1:KiVJ4BqZJaMj4svdfmHM0AUx4NJYO8ZNpPnZn1Z+BBU= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= -golang.org/x/crypto v0.55.0 h1:+KWHjbgOaAQ66dh/YlkZKHlz9ZUlq61AFirAR9ntP8M= -golang.org/x/crypto v0.55.0/go.mod h1:uq0V9dE/fzQuJtbnL+2EhWOE63vo164FY8xqEnV9xis= +golang.org/x/crypto v0.58.0 h1:COkYLr4k7nDI4r6QtMML2AfzeIswWHAJthLS6K/M/54= +golang.org/x/crypto v0.58.0/go.mod h1:Xh+kl5A+M0gMiWDytH2Hhr5Z7WbNCpv/eB/EFgfSk+w= golang.org/x/exp v0.0.0-20250718183923-645b1fa84792 h1:R9PFI6EUdfVKgwKjZef7QIwGcBKu86OEFpJ9nUEP2l4= golang.org/x/exp v0.0.0-20250718183923-645b1fa84792/go.mod h1:A+z0yzpGtvnG90cToK5n2tu8UJVP2XUATh+r+sfOOOc= -golang.org/x/mod v0.41.0 h1:qJmnOUb4YB+FsEuM3HcWucdZASCPGhsX6uljO6pog0c= -golang.org/x/mod v0.41.0/go.mod h1:Ek9pY8RKWXwsWvd3rQiHYtMqkjSUV+s1Rj7j4H5Ur6o= -golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= -golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= -golang.org/x/sync v0.23.0 h1:KameEIfc1IkluZyXWLn39Wd4tURc6GbCiISGiZm2bQk= -golang.org/x/sync v0.23.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= +golang.org/x/mod v0.42.0 h1:ICeL3t2L30ljSPHHxDnR4fqVcBt/zR2zJAb9juavmQg= +golang.org/x/mod v0.42.0/go.mod h1:u5fzIrRInkL8MaO1cbRkUHT64v303YIT5KEqpNr7jRs= +golang.org/x/net v0.61.0 h1:RR+6j/BTBCrggOLugxa+66R8FvoN6MHlzDlZIbN9YFw= +golang.org/x/net v0.61.0/go.mod h1:WgDCOTH8iwtB66T4/GfI94AHo/hhdb7Hah9NDseQfiI= +golang.org/x/sync v0.24.0 h1:iqiDrGoDgyuvAKrhLQthUEzU/R378N78gXbBjxed7oA= +golang.org/x/sync v0.24.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.48.0 h1:bbX/i/6MgT9BVLM9RT1thmxL04yeTAhbEz4SyadbXoo= -golang.org/x/sys v0.48.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= -golang.org/x/term v0.46.0 h1:3+OXuTbaKDgwk8jTi3aSLHRlmWqHEUDUtxnbFigO4YE= -golang.org/x/term v0.46.0/go.mod h1:+K02xbkittuwc0Am4abfA3Fc+XRGXkvBXNO88NCXPoc= -golang.org/x/text v0.42.0 h1:JbOZXgfeCPU9gacVtYliJqOhD+zhrEqK4LfdpmlUZqI= -golang.org/x/text v0.42.0/go.mod h1:ojzP1Z+2QtioaF8DTtO8K5q7JWVVYwZKenzujK0Zd0E= -golang.org/x/tools v0.49.0 h1:3NI7VXzL9+1WZD52Dx2ttoPwD5DWrFGpl9mFZDlmisI= -golang.org/x/tools v0.49.0/go.mod h1:SJNXV9DBKT0UbdttsQjbfJlAE/q+y36++zo3uL3N0Oo= +golang.org/x/sys v0.49.0 h1:XbzkgYJHdqh/8m2Uu0W/dQv8nktxx4BFHp1M0gROTXA= +golang.org/x/sys v0.49.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= +golang.org/x/telemetry v0.0.0-20261010193011-f71dc92da45e h1:P6NGsugec4oASJ+yKMNgTndeo0h2CbixZLvQIe9h5R4= +golang.org/x/telemetry v0.0.0-20261010193011-f71dc92da45e/go.mod h1:GNu+nb+E5axfGmP+Uu3ZVQu5lE/Xk42MjZOHWUD94/o= +golang.org/x/term v0.47.0 h1:cpyOwQkr2Nzxe2p6KnrTG7Ei2wtzjsuSjhpXXepZ/BM= +golang.org/x/term v0.47.0/go.mod h1:efAfAuG6RKABvg1ArGebRkvX6LXul14SM67o2e4mUCY= +golang.org/x/text v0.43.0 h1:1QivrlhwAsnMOcqgOdl9my7s9OyZl8O5/UGUTJVXoWc= +golang.org/x/text v0.43.0/go.mod h1:hbSIYA/amXcRXTFSZqh8tWHEoqRvvbKPJ2uz/KU+a+s= +golang.org/x/tools v0.52.0 h1:ryxg4U63oaUYk7uOLTF37n43f4qgtGvqV4Ioit1BaEs= +golang.org/x/tools v0.52.0/go.mod h1:ItcP5UNaVGG+Yc4eIYmaFLNJ4soEopkx5Y2d4lcEurs= +golang.org/x/tools/go/expect v0.1.1-deprecated h1:jpBZDwmgPhXsKZC6WhL20P4b/wmnpsEAGHaNy0n/rJM= +golang.org/x/tools/go/expect v0.1.1-deprecated/go.mod h1:eihoPOH+FgIqa3FpoTwguz/bVUSGBlGQU67vpBeOrBY= +golang.org/x/tools/go/packages/packagestest v0.1.1-deprecated h1:1h2MnaIAIXISqTFKdENegdpAgUXz6NrPEsbIeWaBRvM= +golang.org/x/tools/go/packages/packagestest v0.1.1-deprecated/go.mod h1:RVAQXBGNv1ib0J382/DPCRS/BPnsGebyM1Gj5VSDpG8= +golang.org/x/vuln v1.9.0 h1:12VaqnI9kJfqwRoPptxoqsUhQtdfrSbdksT7X/KY/sc= +golang.org/x/vuln v1.9.0/go.mod h1:E/Frwm0xp49fTyBW+6CQHdkvobknbwUM49yEpMGUauw= google.golang.org/protobuf v1.36.7 h1:IgrO7UwFQGJdRNXH/sQux4R1Dj1WAKcLElzeeRaXV2A= google.golang.org/protobuf v1.36.7/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/internal/mcp/command_executor.go b/internal/mcp/command_executor.go index 029f2fd9..956e16fd 100644 --- a/internal/mcp/command_executor.go +++ b/internal/mcp/command_executor.go @@ -100,7 +100,7 @@ func mcpProvenance(ctx context.Context) runProvenance { return prov } -//go:generate mockgen -destination=mocks/command_executor.go -package=mocks . CommandExecutor +//go:generate go tool mockgen -destination=mocks/command_executor.go -package=mocks . CommandExecutor type CommandExecutor interface { Execute(args ...string) (string, error) ExecuteContext(ctx context.Context, args ...string) (string, error) diff --git a/internal/mcp/mocks/command_executor.go b/internal/mcp/mocks/command_executor.go index ea1df735..7a64b1c8 100644 --- a/internal/mcp/mocks/command_executor.go +++ b/internal/mcp/mocks/command_executor.go @@ -20,6 +20,7 @@ import ( type MockCommandExecutor struct { ctrl *gomock.Controller recorder *MockCommandExecutorMockRecorder + isgomock struct{} } // MockCommandExecutorMockRecorder is the mock recorder for MockCommandExecutor. @@ -40,10 +41,10 @@ func (m *MockCommandExecutor) EXPECT() *MockCommandExecutorMockRecorder { } // Execute mocks base method. -func (m *MockCommandExecutor) Execute(arg0 ...string) (string, error) { +func (m *MockCommandExecutor) Execute(args ...string) (string, error) { m.ctrl.T.Helper() varargs := []any{} - for _, a := range arg0 { + for _, a := range args { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "Execute", varargs...) @@ -53,16 +54,16 @@ func (m *MockCommandExecutor) Execute(arg0 ...string) (string, error) { } // Execute indicates an expected call of Execute. -func (mr *MockCommandExecutorMockRecorder) Execute(arg0 ...any) *gomock.Call { +func (mr *MockCommandExecutorMockRecorder) Execute(args ...any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Execute", reflect.TypeOf((*MockCommandExecutor)(nil).Execute), arg0...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Execute", reflect.TypeOf((*MockCommandExecutor)(nil).Execute), args...) } // ExecuteContext mocks base method. -func (m *MockCommandExecutor) ExecuteContext(arg0 context.Context, arg1 ...string) (string, error) { +func (m *MockCommandExecutor) ExecuteContext(ctx context.Context, args ...string) (string, error) { m.ctrl.T.Helper() - varargs := []any{arg0} - for _, a := range arg1 { + varargs := []any{ctx} + for _, a := range args { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "ExecuteContext", varargs...) @@ -72,8 +73,8 @@ func (m *MockCommandExecutor) ExecuteContext(arg0 context.Context, arg1 ...strin } // ExecuteContext indicates an expected call of ExecuteContext. -func (mr *MockCommandExecutorMockRecorder) ExecuteContext(arg0 any, arg1 ...any) *gomock.Call { +func (mr *MockCommandExecutorMockRecorder) ExecuteContext(ctx any, args ...any) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]any{arg0}, arg1...) + varargs := append([]any{ctx}, args...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ExecuteContext", reflect.TypeOf((*MockCommandExecutor)(nil).ExecuteContext), varargs...) } diff --git a/internal/runner/engine/engine.go b/internal/runner/engine/engine.go index edfbd8e3..89a7efae 100644 --- a/internal/runner/engine/engine.go +++ b/internal/runner/engine/engine.go @@ -10,7 +10,7 @@ import ( "github.com/flowexec/flow/v2/internal/runner/engine/retry" ) -//go:generate mockgen -destination=mocks/mock_engine.go -package=mocks github.com/flowexec/flow/v2/internal/runner/engine Engine +//go:generate go tool mockgen -destination=mocks/mock_engine.go -package=mocks github.com/flowexec/flow/v2/internal/runner/engine Engine type Result struct { ID string diff --git a/internal/runner/engine/mocks/mock_engine.go b/internal/runner/engine/mocks/mock_engine.go index e635e95c..9b1ca222 100644 --- a/internal/runner/engine/mocks/mock_engine.go +++ b/internal/runner/engine/mocks/mock_engine.go @@ -21,6 +21,7 @@ import ( type MockEngine struct { ctrl *gomock.Controller recorder *MockEngineMockRecorder + isgomock struct{} } // MockEngineMockRecorder is the mock recorder for MockEngine. @@ -41,10 +42,10 @@ func (m *MockEngine) EXPECT() *MockEngineMockRecorder { } // Execute mocks base method. -func (m *MockEngine) Execute(arg0 context.Context, arg1 []engine.Exec, arg2 ...engine.OptionFunc) engine.ResultSummary { +func (m *MockEngine) Execute(ctx context.Context, execs []engine.Exec, opts ...engine.OptionFunc) engine.ResultSummary { m.ctrl.T.Helper() - varargs := []any{arg0, arg1} - for _, a := range arg2 { + varargs := []any{ctx, execs} + for _, a := range opts { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "Execute", varargs...) @@ -53,8 +54,8 @@ func (m *MockEngine) Execute(arg0 context.Context, arg1 []engine.Exec, arg2 ...e } // Execute indicates an expected call of Execute. -func (mr *MockEngineMockRecorder) Execute(arg0, arg1 any, arg2 ...any) *gomock.Call { +func (mr *MockEngineMockRecorder) Execute(ctx, execs any, opts ...any) *gomock.Call { mr.mock.ctrl.T.Helper() - varargs := append([]any{arg0, arg1}, arg2...) + varargs := append([]any{ctx, execs}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Execute", reflect.TypeOf((*MockEngine)(nil).Execute), varargs...) } diff --git a/internal/runner/mocks/mock_runner.go b/internal/runner/mocks/mock_runner.go index ffa3d73d..4e9358c4 100644 --- a/internal/runner/mocks/mock_runner.go +++ b/internal/runner/mocks/mock_runner.go @@ -22,6 +22,7 @@ import ( type MockRunner struct { ctrl *gomock.Controller recorder *MockRunnerMockRecorder + isgomock struct{} } // MockRunnerMockRecorder is the mock recorder for MockRunner. @@ -42,17 +43,17 @@ func (m *MockRunner) EXPECT() *MockRunnerMockRecorder { } // Exec mocks base method. -func (m *MockRunner) Exec(arg0 *context.Context, arg1 *executable.Executable, arg2 engine.Engine, arg3 map[string]string, arg4 []string) error { +func (m *MockRunner) Exec(ctx *context.Context, e *executable.Executable, eng engine.Engine, inputEnv map[string]string, inputArgs []string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "Exec", arg0, arg1, arg2, arg3, arg4) + ret := m.ctrl.Call(m, "Exec", ctx, e, eng, inputEnv, inputArgs) ret0, _ := ret[0].(error) return ret0 } // Exec indicates an expected call of Exec. -func (mr *MockRunnerMockRecorder) Exec(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call { +func (mr *MockRunnerMockRecorder) Exec(ctx, e, eng, inputEnv, inputArgs any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Exec", reflect.TypeOf((*MockRunner)(nil).Exec), arg0, arg1, arg2, arg3, arg4) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Exec", reflect.TypeOf((*MockRunner)(nil).Exec), ctx, e, eng, inputEnv, inputArgs) } // IsCompatible mocks base method. diff --git a/internal/runner/runner.go b/internal/runner/runner.go index 2c375184..4631bd59 100644 --- a/internal/runner/runner.go +++ b/internal/runner/runner.go @@ -13,7 +13,7 @@ import ( "github.com/flowexec/flow/v2/types/executable" ) -//go:generate mockgen -destination=mocks/mock_runner.go -package=mocks github.com/flowexec/flow/v2/internal/runner Runner +//go:generate go tool mockgen -destination=mocks/mock_runner.go -package=mocks github.com/flowexec/flow/v2/internal/runner Runner type Runner interface { Name() string Exec( diff --git a/pkg/cache/executables_cache.go b/pkg/cache/executables_cache.go index 69167ab6..2a61bd21 100644 --- a/pkg/cache/executables_cache.go +++ b/pkg/cache/executables_cache.go @@ -24,7 +24,7 @@ import ( const execCacheKey = "executables" -//go:generate mockgen -destination=mocks/mock_executable_cache.go -package=mocks github.com/flowexec/flow/v2/pkg/cache ExecutableCache +//go:generate go tool mockgen -destination=mocks/mock_executable_cache.go -package=mocks github.com/flowexec/flow/v2/pkg/cache ExecutableCache type ExecutableCache interface { Update() error GetExecutableByRef(ref executable.Ref) (*executable.Executable, error) diff --git a/pkg/cache/mocks/mock_executable_cache.go b/pkg/cache/mocks/mock_executable_cache.go index bcc0bca4..0b4ee0fc 100644 --- a/pkg/cache/mocks/mock_executable_cache.go +++ b/pkg/cache/mocks/mock_executable_cache.go @@ -20,6 +20,7 @@ import ( type MockExecutableCache struct { ctrl *gomock.Controller recorder *MockExecutableCacheMockRecorder + isgomock struct{} } // MockExecutableCacheMockRecorder is the mock recorder for MockExecutableCache. @@ -55,18 +56,18 @@ func (mr *MockExecutableCacheMockRecorder) AliasRefs() *gomock.Call { } // GetExecutableByRef mocks base method. -func (m *MockExecutableCache) GetExecutableByRef(arg0 executable.Ref) (*executable.Executable, error) { +func (m *MockExecutableCache) GetExecutableByRef(ref executable.Ref) (*executable.Executable, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetExecutableByRef", arg0) + ret := m.ctrl.Call(m, "GetExecutableByRef", ref) ret0, _ := ret[0].(*executable.Executable) ret1, _ := ret[1].(error) return ret0, ret1 } // GetExecutableByRef indicates an expected call of GetExecutableByRef. -func (mr *MockExecutableCacheMockRecorder) GetExecutableByRef(arg0 any) *gomock.Call { +func (mr *MockExecutableCacheMockRecorder) GetExecutableByRef(ref any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetExecutableByRef", reflect.TypeOf((*MockExecutableCache)(nil).GetExecutableByRef), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetExecutableByRef", reflect.TypeOf((*MockExecutableCache)(nil).GetExecutableByRef), ref) } // GetExecutableList mocks base method. diff --git a/pkg/cache/mocks/mock_template_cache.go b/pkg/cache/mocks/mock_template_cache.go index 47f8c7e2..8105e4cc 100644 --- a/pkg/cache/mocks/mock_template_cache.go +++ b/pkg/cache/mocks/mock_template_cache.go @@ -20,6 +20,7 @@ import ( type MockTemplateCache struct { ctrl *gomock.Controller recorder *MockTemplateCacheMockRecorder + isgomock struct{} } // MockTemplateCacheMockRecorder is the mock recorder for MockTemplateCache. @@ -40,18 +41,18 @@ func (m *MockTemplateCache) EXPECT() *MockTemplateCacheMockRecorder { } // GetTemplate mocks base method. -func (m *MockTemplateCache) GetTemplate(arg0 string) (*executable.Template, error) { +func (m *MockTemplateCache) GetTemplate(name string) (*executable.Template, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetTemplate", arg0) + ret := m.ctrl.Call(m, "GetTemplate", name) ret0, _ := ret[0].(*executable.Template) ret1, _ := ret[1].(error) return ret0, ret1 } // GetTemplate indicates an expected call of GetTemplate. -func (mr *MockTemplateCacheMockRecorder) GetTemplate(arg0 any) *gomock.Call { +func (mr *MockTemplateCacheMockRecorder) GetTemplate(name any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTemplate", reflect.TypeOf((*MockTemplateCache)(nil).GetTemplate), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTemplate", reflect.TypeOf((*MockTemplateCache)(nil).GetTemplate), name) } // GetTemplateList mocks base method. diff --git a/pkg/cache/mocks/mock_workspace_cache.go b/pkg/cache/mocks/mock_workspace_cache.go index c9e90981..61f38dc6 100644 --- a/pkg/cache/mocks/mock_workspace_cache.go +++ b/pkg/cache/mocks/mock_workspace_cache.go @@ -21,6 +21,7 @@ import ( type MockWorkspaceCache struct { ctrl *gomock.Controller recorder *MockWorkspaceCacheMockRecorder + isgomock struct{} } // MockWorkspaceCacheMockRecorder is the mock recorder for MockWorkspaceCache. diff --git a/pkg/cache/templates_cache.go b/pkg/cache/templates_cache.go index 94b0e8dc..be1992d4 100644 --- a/pkg/cache/templates_cache.go +++ b/pkg/cache/templates_cache.go @@ -19,7 +19,7 @@ import ( const tmplCacheKey = "templates" -//go:generate mockgen -destination=mocks/mock_template_cache.go -package=mocks github.com/flowexec/flow/v2/pkg/cache TemplateCache +//go:generate go tool mockgen -destination=mocks/mock_template_cache.go -package=mocks github.com/flowexec/flow/v2/pkg/cache TemplateCache type TemplateCache interface { Update() error // GetTemplate resolves a discovered template by its flat name, or by a diff --git a/pkg/cache/workspaces_cache.go b/pkg/cache/workspaces_cache.go index 40ba71c4..bfdbfaa0 100644 --- a/pkg/cache/workspaces_cache.go +++ b/pkg/cache/workspaces_cache.go @@ -18,7 +18,7 @@ import ( const wsCacheKey = "workspaces" -//go:generate mockgen -destination=mocks/mock_workspace_cache.go -package=mocks github.com/flowexec/flow/v2/pkg/cache WorkspaceCache +//go:generate go tool mockgen -destination=mocks/mock_workspace_cache.go -package=mocks github.com/flowexec/flow/v2/pkg/cache WorkspaceCache type WorkspaceCache interface { Update() error GetData() *WorkspaceCacheData diff --git a/pkg/store/mocks/mock_data_store.go b/pkg/store/mocks/mock_data_store.go index 9defc7bd..873f8532 100644 --- a/pkg/store/mocks/mock_data_store.go +++ b/pkg/store/mocks/mock_data_store.go @@ -20,6 +20,7 @@ import ( type MockDataStore struct { ctrl *gomock.Controller recorder *MockDataStoreMockRecorder + isgomock struct{} } // MockDataStoreMockRecorder is the mock recorder for MockDataStore. @@ -54,237 +55,237 @@ func (mr *MockDataStoreMockRecorder) Close() *gomock.Call { } // CreateProcessBucket mocks base method. -func (m *MockDataStore) CreateProcessBucket(arg0 string) error { +func (m *MockDataStore) CreateProcessBucket(id string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "CreateProcessBucket", arg0) + ret := m.ctrl.Call(m, "CreateProcessBucket", id) ret0, _ := ret[0].(error) return ret0 } // CreateProcessBucket indicates an expected call of CreateProcessBucket. -func (mr *MockDataStoreMockRecorder) CreateProcessBucket(arg0 any) *gomock.Call { +func (mr *MockDataStoreMockRecorder) CreateProcessBucket(id any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateProcessBucket", reflect.TypeOf((*MockDataStore)(nil).CreateProcessBucket), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateProcessBucket", reflect.TypeOf((*MockDataStore)(nil).CreateProcessBucket), id) } // DeleteBackgroundRun mocks base method. -func (m *MockDataStore) DeleteBackgroundRun(arg0 string) error { +func (m *MockDataStore) DeleteBackgroundRun(id string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DeleteBackgroundRun", arg0) + ret := m.ctrl.Call(m, "DeleteBackgroundRun", id) ret0, _ := ret[0].(error) return ret0 } // DeleteBackgroundRun indicates an expected call of DeleteBackgroundRun. -func (mr *MockDataStoreMockRecorder) DeleteBackgroundRun(arg0 any) *gomock.Call { +func (mr *MockDataStoreMockRecorder) DeleteBackgroundRun(id any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteBackgroundRun", reflect.TypeOf((*MockDataStore)(nil).DeleteBackgroundRun), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteBackgroundRun", reflect.TypeOf((*MockDataStore)(nil).DeleteBackgroundRun), id) } // DeleteCacheEntry mocks base method. -func (m *MockDataStore) DeleteCacheEntry(arg0 string) error { +func (m *MockDataStore) DeleteCacheEntry(key string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DeleteCacheEntry", arg0) + ret := m.ctrl.Call(m, "DeleteCacheEntry", key) ret0, _ := ret[0].(error) return ret0 } // DeleteCacheEntry indicates an expected call of DeleteCacheEntry. -func (mr *MockDataStoreMockRecorder) DeleteCacheEntry(arg0 any) *gomock.Call { +func (mr *MockDataStoreMockRecorder) DeleteCacheEntry(key any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteCacheEntry", reflect.TypeOf((*MockDataStore)(nil).DeleteCacheEntry), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteCacheEntry", reflect.TypeOf((*MockDataStore)(nil).DeleteCacheEntry), key) } // DeleteExecutionHistory mocks base method. -func (m *MockDataStore) DeleteExecutionHistory(arg0 string) error { +func (m *MockDataStore) DeleteExecutionHistory(ref string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DeleteExecutionHistory", arg0) + ret := m.ctrl.Call(m, "DeleteExecutionHistory", ref) ret0, _ := ret[0].(error) return ret0 } // DeleteExecutionHistory indicates an expected call of DeleteExecutionHistory. -func (mr *MockDataStoreMockRecorder) DeleteExecutionHistory(arg0 any) *gomock.Call { +func (mr *MockDataStoreMockRecorder) DeleteExecutionHistory(ref any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteExecutionHistory", reflect.TypeOf((*MockDataStore)(nil).DeleteExecutionHistory), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteExecutionHistory", reflect.TypeOf((*MockDataStore)(nil).DeleteExecutionHistory), ref) } // DeleteProcessBucket mocks base method. -func (m *MockDataStore) DeleteProcessBucket(arg0 string) error { +func (m *MockDataStore) DeleteProcessBucket(id string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DeleteProcessBucket", arg0) + ret := m.ctrl.Call(m, "DeleteProcessBucket", id) ret0, _ := ret[0].(error) return ret0 } // DeleteProcessBucket indicates an expected call of DeleteProcessBucket. -func (mr *MockDataStoreMockRecorder) DeleteProcessBucket(arg0 any) *gomock.Call { +func (mr *MockDataStoreMockRecorder) DeleteProcessBucket(id any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteProcessBucket", reflect.TypeOf((*MockDataStore)(nil).DeleteProcessBucket), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteProcessBucket", reflect.TypeOf((*MockDataStore)(nil).DeleteProcessBucket), id) } // DeleteProcessVar mocks base method. -func (m *MockDataStore) DeleteProcessVar(arg0, arg1 string) error { +func (m *MockDataStore) DeleteProcessVar(bucketID, key string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "DeleteProcessVar", arg0, arg1) + ret := m.ctrl.Call(m, "DeleteProcessVar", bucketID, key) ret0, _ := ret[0].(error) return ret0 } // DeleteProcessVar indicates an expected call of DeleteProcessVar. -func (mr *MockDataStoreMockRecorder) DeleteProcessVar(arg0, arg1 any) *gomock.Call { +func (mr *MockDataStoreMockRecorder) DeleteProcessVar(bucketID, key any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteProcessVar", reflect.TypeOf((*MockDataStore)(nil).DeleteProcessVar), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteProcessVar", reflect.TypeOf((*MockDataStore)(nil).DeleteProcessVar), bucketID, key) } // GetAllExecutionHistory mocks base method. -func (m *MockDataStore) GetAllExecutionHistory(arg0 int) (map[string][]store.ExecutionRecord, error) { +func (m *MockDataStore) GetAllExecutionHistory(limitPerRef int) (map[string][]store.ExecutionRecord, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetAllExecutionHistory", arg0) + ret := m.ctrl.Call(m, "GetAllExecutionHistory", limitPerRef) ret0, _ := ret[0].(map[string][]store.ExecutionRecord) ret1, _ := ret[1].(error) return ret0, ret1 } // GetAllExecutionHistory indicates an expected call of GetAllExecutionHistory. -func (mr *MockDataStoreMockRecorder) GetAllExecutionHistory(arg0 any) *gomock.Call { +func (mr *MockDataStoreMockRecorder) GetAllExecutionHistory(limitPerRef any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAllExecutionHistory", reflect.TypeOf((*MockDataStore)(nil).GetAllExecutionHistory), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAllExecutionHistory", reflect.TypeOf((*MockDataStore)(nil).GetAllExecutionHistory), limitPerRef) } // GetAllProcessVars mocks base method. -func (m *MockDataStore) GetAllProcessVars(arg0 string) (map[string]string, error) { +func (m *MockDataStore) GetAllProcessVars(bucketID string) (map[string]string, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetAllProcessVars", arg0) + ret := m.ctrl.Call(m, "GetAllProcessVars", bucketID) ret0, _ := ret[0].(map[string]string) ret1, _ := ret[1].(error) return ret0, ret1 } // GetAllProcessVars indicates an expected call of GetAllProcessVars. -func (mr *MockDataStoreMockRecorder) GetAllProcessVars(arg0 any) *gomock.Call { +func (mr *MockDataStoreMockRecorder) GetAllProcessVars(bucketID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAllProcessVars", reflect.TypeOf((*MockDataStore)(nil).GetAllProcessVars), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAllProcessVars", reflect.TypeOf((*MockDataStore)(nil).GetAllProcessVars), bucketID) } // GetBackgroundRun mocks base method. -func (m *MockDataStore) GetBackgroundRun(arg0 string) (store.BackgroundRun, error) { +func (m *MockDataStore) GetBackgroundRun(id string) (store.BackgroundRun, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetBackgroundRun", arg0) + ret := m.ctrl.Call(m, "GetBackgroundRun", id) ret0, _ := ret[0].(store.BackgroundRun) ret1, _ := ret[1].(error) return ret0, ret1 } // GetBackgroundRun indicates an expected call of GetBackgroundRun. -func (mr *MockDataStoreMockRecorder) GetBackgroundRun(arg0 any) *gomock.Call { +func (mr *MockDataStoreMockRecorder) GetBackgroundRun(id any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBackgroundRun", reflect.TypeOf((*MockDataStore)(nil).GetBackgroundRun), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBackgroundRun", reflect.TypeOf((*MockDataStore)(nil).GetBackgroundRun), id) } // GetBackgroundRuns mocks base method. -func (m *MockDataStore) GetBackgroundRuns(arg0 []string) (map[string]store.BackgroundRun, error) { +func (m *MockDataStore) GetBackgroundRuns(ids []string) (map[string]store.BackgroundRun, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetBackgroundRuns", arg0) + ret := m.ctrl.Call(m, "GetBackgroundRuns", ids) ret0, _ := ret[0].(map[string]store.BackgroundRun) ret1, _ := ret[1].(error) return ret0, ret1 } // GetBackgroundRuns indicates an expected call of GetBackgroundRuns. -func (mr *MockDataStoreMockRecorder) GetBackgroundRuns(arg0 any) *gomock.Call { +func (mr *MockDataStoreMockRecorder) GetBackgroundRuns(ids any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBackgroundRuns", reflect.TypeOf((*MockDataStore)(nil).GetBackgroundRuns), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBackgroundRuns", reflect.TypeOf((*MockDataStore)(nil).GetBackgroundRuns), ids) } // GetCacheEntries mocks base method. -func (m *MockDataStore) GetCacheEntries(arg0 []string) (map[string][]byte, error) { +func (m *MockDataStore) GetCacheEntries(keys []string) (map[string][]byte, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetCacheEntries", arg0) + ret := m.ctrl.Call(m, "GetCacheEntries", keys) ret0, _ := ret[0].(map[string][]byte) ret1, _ := ret[1].(error) return ret0, ret1 } // GetCacheEntries indicates an expected call of GetCacheEntries. -func (mr *MockDataStoreMockRecorder) GetCacheEntries(arg0 any) *gomock.Call { +func (mr *MockDataStoreMockRecorder) GetCacheEntries(keys any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCacheEntries", reflect.TypeOf((*MockDataStore)(nil).GetCacheEntries), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCacheEntries", reflect.TypeOf((*MockDataStore)(nil).GetCacheEntries), keys) } // GetCacheEntry mocks base method. -func (m *MockDataStore) GetCacheEntry(arg0 string) ([]byte, error) { +func (m *MockDataStore) GetCacheEntry(key string) ([]byte, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetCacheEntry", arg0) + ret := m.ctrl.Call(m, "GetCacheEntry", key) ret0, _ := ret[0].([]byte) ret1, _ := ret[1].(error) return ret0, ret1 } // GetCacheEntry indicates an expected call of GetCacheEntry. -func (mr *MockDataStoreMockRecorder) GetCacheEntry(arg0 any) *gomock.Call { +func (mr *MockDataStoreMockRecorder) GetCacheEntry(key any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCacheEntry", reflect.TypeOf((*MockDataStore)(nil).GetCacheEntry), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCacheEntry", reflect.TypeOf((*MockDataStore)(nil).GetCacheEntry), key) } // GetExecutionHistories mocks base method. -func (m *MockDataStore) GetExecutionHistories(arg0 []string, arg1 int) (map[string][]store.ExecutionRecord, error) { +func (m *MockDataStore) GetExecutionHistories(refs []string, limit int) (map[string][]store.ExecutionRecord, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetExecutionHistories", arg0, arg1) + ret := m.ctrl.Call(m, "GetExecutionHistories", refs, limit) ret0, _ := ret[0].(map[string][]store.ExecutionRecord) ret1, _ := ret[1].(error) return ret0, ret1 } // GetExecutionHistories indicates an expected call of GetExecutionHistories. -func (mr *MockDataStoreMockRecorder) GetExecutionHistories(arg0, arg1 any) *gomock.Call { +func (mr *MockDataStoreMockRecorder) GetExecutionHistories(refs, limit any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetExecutionHistories", reflect.TypeOf((*MockDataStore)(nil).GetExecutionHistories), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetExecutionHistories", reflect.TypeOf((*MockDataStore)(nil).GetExecutionHistories), refs, limit) } // GetExecutionHistory mocks base method. -func (m *MockDataStore) GetExecutionHistory(arg0 string, arg1 int) ([]store.ExecutionRecord, error) { +func (m *MockDataStore) GetExecutionHistory(ref string, limit int) ([]store.ExecutionRecord, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetExecutionHistory", arg0, arg1) + ret := m.ctrl.Call(m, "GetExecutionHistory", ref, limit) ret0, _ := ret[0].([]store.ExecutionRecord) ret1, _ := ret[1].(error) return ret0, ret1 } // GetExecutionHistory indicates an expected call of GetExecutionHistory. -func (mr *MockDataStoreMockRecorder) GetExecutionHistory(arg0, arg1 any) *gomock.Call { +func (mr *MockDataStoreMockRecorder) GetExecutionHistory(ref, limit any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetExecutionHistory", reflect.TypeOf((*MockDataStore)(nil).GetExecutionHistory), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetExecutionHistory", reflect.TypeOf((*MockDataStore)(nil).GetExecutionHistory), ref, limit) } // GetProcessVar mocks base method. -func (m *MockDataStore) GetProcessVar(arg0, arg1 string) (string, error) { +func (m *MockDataStore) GetProcessVar(bucketID, key string) (string, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetProcessVar", arg0, arg1) + ret := m.ctrl.Call(m, "GetProcessVar", bucketID, key) ret0, _ := ret[0].(string) ret1, _ := ret[1].(error) return ret0, ret1 } // GetProcessVar indicates an expected call of GetProcessVar. -func (mr *MockDataStoreMockRecorder) GetProcessVar(arg0, arg1 any) *gomock.Call { +func (mr *MockDataStoreMockRecorder) GetProcessVar(bucketID, key any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetProcessVar", reflect.TypeOf((*MockDataStore)(nil).GetProcessVar), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetProcessVar", reflect.TypeOf((*MockDataStore)(nil).GetProcessVar), bucketID, key) } // GetProcessVarKeys mocks base method. -func (m *MockDataStore) GetProcessVarKeys(arg0 string) ([]string, error) { +func (m *MockDataStore) GetProcessVarKeys(bucketID string) ([]string, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetProcessVarKeys", arg0) + ret := m.ctrl.Call(m, "GetProcessVarKeys", bucketID) ret0, _ := ret[0].([]string) ret1, _ := ret[1].(error) return ret0, ret1 } // GetProcessVarKeys indicates an expected call of GetProcessVarKeys. -func (mr *MockDataStoreMockRecorder) GetProcessVarKeys(arg0 any) *gomock.Call { +func (mr *MockDataStoreMockRecorder) GetProcessVarKeys(bucketID any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetProcessVarKeys", reflect.TypeOf((*MockDataStore)(nil).GetProcessVarKeys), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetProcessVarKeys", reflect.TypeOf((*MockDataStore)(nil).GetProcessVarKeys), bucketID) } // ListBackgroundRuns mocks base method. @@ -318,57 +319,57 @@ func (mr *MockDataStoreMockRecorder) ListExecutionRefs() *gomock.Call { } // RecordExecution mocks base method. -func (m *MockDataStore) RecordExecution(arg0 store.ExecutionRecord) error { +func (m *MockDataStore) RecordExecution(record store.ExecutionRecord) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "RecordExecution", arg0) + ret := m.ctrl.Call(m, "RecordExecution", record) ret0, _ := ret[0].(error) return ret0 } // RecordExecution indicates an expected call of RecordExecution. -func (mr *MockDataStoreMockRecorder) RecordExecution(arg0 any) *gomock.Call { +func (mr *MockDataStoreMockRecorder) RecordExecution(record any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecordExecution", reflect.TypeOf((*MockDataStore)(nil).RecordExecution), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecordExecution", reflect.TypeOf((*MockDataStore)(nil).RecordExecution), record) } // SaveBackgroundRun mocks base method. -func (m *MockDataStore) SaveBackgroundRun(arg0 store.BackgroundRun) error { +func (m *MockDataStore) SaveBackgroundRun(run store.BackgroundRun) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SaveBackgroundRun", arg0) + ret := m.ctrl.Call(m, "SaveBackgroundRun", run) ret0, _ := ret[0].(error) return ret0 } // SaveBackgroundRun indicates an expected call of SaveBackgroundRun. -func (mr *MockDataStoreMockRecorder) SaveBackgroundRun(arg0 any) *gomock.Call { +func (mr *MockDataStoreMockRecorder) SaveBackgroundRun(run any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SaveBackgroundRun", reflect.TypeOf((*MockDataStore)(nil).SaveBackgroundRun), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SaveBackgroundRun", reflect.TypeOf((*MockDataStore)(nil).SaveBackgroundRun), run) } // SetCacheEntry mocks base method. -func (m *MockDataStore) SetCacheEntry(arg0 string, arg1 []byte) error { +func (m *MockDataStore) SetCacheEntry(key string, value []byte) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SetCacheEntry", arg0, arg1) + ret := m.ctrl.Call(m, "SetCacheEntry", key, value) ret0, _ := ret[0].(error) return ret0 } // SetCacheEntry indicates an expected call of SetCacheEntry. -func (mr *MockDataStoreMockRecorder) SetCacheEntry(arg0, arg1 any) *gomock.Call { +func (mr *MockDataStoreMockRecorder) SetCacheEntry(key, value any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetCacheEntry", reflect.TypeOf((*MockDataStore)(nil).SetCacheEntry), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetCacheEntry", reflect.TypeOf((*MockDataStore)(nil).SetCacheEntry), key, value) } // SetProcessVar mocks base method. -func (m *MockDataStore) SetProcessVar(arg0, arg1, arg2 string) error { +func (m *MockDataStore) SetProcessVar(bucketID, key, value string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SetProcessVar", arg0, arg1, arg2) + ret := m.ctrl.Call(m, "SetProcessVar", bucketID, key, value) ret0, _ := ret[0].(error) return ret0 } // SetProcessVar indicates an expected call of SetProcessVar. -func (mr *MockDataStoreMockRecorder) SetProcessVar(arg0, arg1, arg2 any) *gomock.Call { +func (mr *MockDataStoreMockRecorder) SetProcessVar(bucketID, key, value any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetProcessVar", reflect.TypeOf((*MockDataStore)(nil).SetProcessVar), arg0, arg1, arg2) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetProcessVar", reflect.TypeOf((*MockDataStore)(nil).SetProcessVar), bucketID, key, value) } diff --git a/pkg/store/store.go b/pkg/store/store.go index 1cd06118..618a9309 100644 --- a/pkg/store/store.go +++ b/pkg/store/store.go @@ -49,7 +49,7 @@ const ( // DataStore manages structured internal state (cache, execution history, and process env vars). // It is intentionally in pkg/ so external consumers (e.g. pro wrapper) can import it. // -//go:generate mockgen -destination=mocks/mock_data_store.go -package=mocks github.com/flowexec/flow/v2/pkg/store DataStore +//go:generate go tool mockgen -destination=mocks/mock_data_store.go -package=mocks github.com/flowexec/flow/v2/pkg/store DataStore type DataStore interface { //nolint:interfacebloat // single backing store with cache, history, and process var concerns SetCacheEntry(key string, value []byte) error GetCacheEntry(key string) ([]byte, error)