From 9c30b69187382b3dc1bda58069ad01a18f46acef Mon Sep 17 00:00:00 2001 From: Nicole Jung <31713368+purplenicole730@users.noreply.github.com> Date: Fri, 1 Nov 2024 15:54:10 -0400 Subject: [PATCH] RSDK-9098: test go in module generation test (#4504) --- .github/workflows/test-module-generation.yml | 3 ++- cli/app.go | 6 ++++++ cli/module_generate.go | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-module-generation.yml b/.github/workflows/test-module-generation.yml index fced9e55b5c..23e1b925b50 100644 --- a/.github/workflows/test-module-generation.yml +++ b/.github/workflows/test-module-generation.yml @@ -10,6 +10,7 @@ jobs: strategy: fail-fast: true matrix: + language: ["python", "go"] resource: [ { subtype: "arm", type: "component" }, @@ -46,7 +47,7 @@ jobs: go-version-file: go.mod - name: Run module generator - run: go run ./cli/viam --debug module generate --resource-subtype "${{ matrix.resource.subtype }}" --resource-type "${{ matrix.resource.type }}" + run: go run ./cli/viam --debug module generate --resource-subtype "${{ matrix.resource.subtype }}" --resource-type "${{ matrix.resource.type }}" --language "${{ matrix.language }}" - name: Run module run: | diff --git a/cli/app.go b/cli/app.go index 275e1ab1abf..a7fe3126314 100644 --- a/cli/app.go +++ b/cli/app.go @@ -42,6 +42,7 @@ const ( apiKeyCreateFlagName = "name" moduleFlagName = "name" + moduleFlagLanguage = "language" moduleFlagPublicNamespace = "public-namespace" moduleFlagPath = "module" moduleFlagVersion = "version" @@ -1496,6 +1497,11 @@ After creation, use 'viam module update' to push your new module to app.viam.com Name: "generate", Usage: "generate a new modular resource via prompts", Flags: []cli.Flag{ + &cli.StringFlag{ + Name: moduleFlagLanguage, + Usage: "language to use for module", + Value: "python", + }, &cli.StringFlag{ Name: moduleFlagResourceType, Usage: "resource type to use in module", diff --git a/cli/module_generate.go b/cli/module_generate.go index 598cc517028..ef730f9809f 100644 --- a/cli/module_generate.go +++ b/cli/module_generate.go @@ -65,7 +65,7 @@ func (c *viamClient) generateModuleAction(cCtx *cli.Context) error { ModuleName: "my-module", IsPublic: false, Namespace: "my-org", - Language: python, + Language: cCtx.String(moduleFlagLanguage), Resource: resourceSubtype + " " + resourceType, ResourceType: resourceType, ResourceSubtype: resourceSubtype,