From 26ad6dfc78ce166e9d4f5973b757ca9ce15d6436 Mon Sep 17 00:00:00 2001 From: xavidop Date: Tue, 31 Dec 2024 13:48:13 +0100 Subject: [PATCH] fix: lint issues and remove fig --- .github/workflows/fig.yml | 28 ---------------------------- cmd/agent/create.go | 10 +++++----- cmd/agent/delete.go | 6 +++--- cmd/agent/export.go | 10 +++++----- cmd/agent/restore.go | 8 ++++---- cmd/agent/update.go | 6 +++--- cmd/dialog.go | 8 ++++---- cmd/entitytype/create.go | 10 +++++----- cmd/entitytype/delete.go | 8 ++++---- cmd/entitytype/update.go | 10 +++++----- cmd/environment/create.go | 10 +++++----- cmd/environment/delete.go | 8 ++++---- cmd/environment/execute.go | 8 ++++---- cmd/environment/update.go | 10 +++++----- cmd/flow/create.go | 8 ++++---- cmd/flow/delete.go | 8 ++++---- cmd/flow/train.go | 8 ++++---- cmd/flow/update.go | 8 ++++---- cmd/flowversion/create.go | 10 +++++----- cmd/flowversion/delete.go | 10 +++++----- cmd/flowversion/update.go | 10 +++++----- cmd/generator/create.go | 10 +++++----- cmd/generator/delete.go | 8 ++++---- cmd/generator/update.go | 10 +++++----- cmd/intent/create.go | 10 +++++----- cmd/intent/delete.go | 8 ++++---- cmd/intent/update.go | 8 ++++---- cmd/profileconversation/execute.go | 2 +- cmd/profilenlu/execute.go | 2 +- cmd/root.go | 1 - cmd/stt/recognize.go | 4 ++-- cmd/tts/synthesize.go | 4 ++-- cmd/webhook/create.go | 10 +++++----- cmd/webhook/delete.go | 8 ++++---- cmd/webhook/update.go | 10 +++++----- go.mod | 5 ++--- go.sum | 2 -- pkg/environment/execute-cicd.go | 2 +- pkg/profileconversation/execute.go | 8 ++++---- pkg/profilenlu/execute.go | 6 +++--- 40 files changed, 144 insertions(+), 176 deletions(-) delete mode 100644 .github/workflows/fig.yml diff --git a/.github/workflows/fig.yml b/.github/workflows/fig.yml deleted file mode 100644 index 86621f62..00000000 --- a/.github/workflows/fig.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: fig - -on: - workflow_dispatch: - push: - tags: - - 'v*' - -permissions: - contents: read - -jobs: - fig: - runs-on: ubuntu-latest - steps: - - uses: actions/setup-node@v4 - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 - with: - go-version: stable - cache: true - - run: go mod tidy && go run . generate-fig-spec >cxcli.ts - - uses: withfig/push-to-fig-autocomplete-action@v2 - with: - token: ${{ secrets.GO_RELEASER_GITHUB_TOKEN }} - autocomplete-spec-name: cxcli - spec-path: cxcli.ts - integration: commander \ No newline at end of file diff --git a/cmd/agent/create.go b/cmd/agent/create.go index aec43495..d9fbd02b 100644 --- a/cmd/agent/create.go +++ b/cmd/agent/create.go @@ -45,7 +45,7 @@ var createCmd = &cobra.Command{ } if err := agent.Create(agentName, locationID, projectID, createInput); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } }, @@ -61,22 +61,22 @@ func init() { createCmd.Flags().StringP("project-id", "p", "", "Dialogflow CX Project ID (required)") if err := createCmd.MarkFlagRequired("project-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } createCmd.Flags().StringP("location-id", "l", "", "Dialogflow CX Location ID of the Project (required)") if err := createCmd.MarkFlagRequired("location-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } createCmd.Flags().StringP("locale", "e", "", "Default locale of the agent (required)") if err := createCmd.MarkFlagRequired("locale"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } createCmd.Flags().StringP("timezone", "t", "", "Timezone of the agent from the time zone database https://www.iana.org/time-zones. Example: America/New_York, Europe/Madrid (required)") if err := createCmd.MarkFlagRequired("timezone"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } createCmd.Flags().StringP("description", "d", "", "Description of the agent (optional)") diff --git a/cmd/agent/delete.go b/cmd/agent/delete.go index f4e0e96b..34bd386f 100644 --- a/cmd/agent/delete.go +++ b/cmd/agent/delete.go @@ -22,7 +22,7 @@ var deleteCmd = &cobra.Command{ agentName := args[0] if err := agent.Delete(locationID, projectID, agentName); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } }, @@ -38,12 +38,12 @@ func init() { deleteCmd.Flags().StringP("project-id", "p", "", "Dialogflow CX Project ID (required)") if err := deleteCmd.MarkFlagRequired("project-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } deleteCmd.Flags().StringP("location-id", "l", "", "Dialogflow CX Location ID of the Project (required)") if err := deleteCmd.MarkFlagRequired("location-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } } diff --git a/cmd/agent/export.go b/cmd/agent/export.go index 55677935..da2ce2fb 100644 --- a/cmd/agent/export.go +++ b/cmd/agent/export.go @@ -23,17 +23,17 @@ var exportCmd = &cobra.Command{ output, _ := cmd.Flags().GetString("output-file") exportFormat, _ := cmd.Flags().GetString("export-format") if err := utils.ValidateExportFormat(exportFormat); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } if err := utils.ValidateExportOutputFileAndFormatCorrelation(output, exportFormat); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } agentName := args[0] if err := agent.Export(locationID, projectID, agentName, output, exportFormat); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } }, @@ -49,12 +49,12 @@ func init() { exportCmd.Flags().StringP("project-id", "p", "", "Dialogflow CX Project ID (required)") if err := exportCmd.MarkFlagRequired("project-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } exportCmd.Flags().StringP("location-id", "l", "", "Dialogflow CX Location ID of the Project (required)") if err := exportCmd.MarkFlagRequired("location-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } exportCmd.Flags().StringP("output-file", "f", "agent.blob", "Output file name. Default: agent.blob (optional)") diff --git a/cmd/agent/restore.go b/cmd/agent/restore.go index 127eefd1..6df4e9ab 100644 --- a/cmd/agent/restore.go +++ b/cmd/agent/restore.go @@ -22,13 +22,13 @@ var restoreCmd = &cobra.Command{ projectID, _ := cmd.Flags().GetString("project-id") input, _ := cmd.Flags().GetString("input") if err := utils.ValidateAgentFileType(input); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } agentName := args[0] if err := agent.Restore(locationID, projectID, agentName, input); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } }, @@ -44,12 +44,12 @@ func init() { restoreCmd.Flags().StringP("project-id", "p", "", "Dialogflow CX Project ID (required)") if err := restoreCmd.MarkFlagRequired("project-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } restoreCmd.Flags().StringP("location-id", "l", "", "Dialogflow CX Location ID of the Project (required)") if err := restoreCmd.MarkFlagRequired("location-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } restoreCmd.Flags().StringP("input", "i", "agent.blob", "Input file name. Default: agent.blob (optional)") diff --git a/cmd/agent/update.go b/cmd/agent/update.go index 8db59910..b3f8b20e 100644 --- a/cmd/agent/update.go +++ b/cmd/agent/update.go @@ -43,7 +43,7 @@ var updateCmd = &cobra.Command{ } if err := agent.Update(agentName, locationID, projectID, updateInput); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } }, @@ -59,12 +59,12 @@ func init() { updateCmd.Flags().StringP("project-id", "p", "", "Dialogflow CX Project ID (required)") if err := updateCmd.MarkFlagRequired("project-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } updateCmd.Flags().StringP("location-id", "l", "", "Dialogflow CX Location ID of the Project (required)") if err := updateCmd.MarkFlagRequired("location-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } updateCmd.Flags().StringP("timezone", "t", "", "Timezone of the agent from the time zone database https://www.iana.org/time-zones. Example: America/New_York, Europe/Madrid (optional)") diff --git a/cmd/dialog.go b/cmd/dialog.go index 9f724604..bd64f256 100644 --- a/cmd/dialog.go +++ b/cmd/dialog.go @@ -21,7 +21,7 @@ var dialogCmd = &cobra.Command{ agentName, _ := cmd.Flags().GetString("agent-name") localeId, _ := cmd.Flags().GetString("locale") if err := dialog.Dialog(locationID, projectID, agentName, localeId); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } }, @@ -37,17 +37,17 @@ func init() { dialogCmd.Flags().StringP("project-id", "p", "", "Dialogflow CX Project ID (required)") if err := dialogCmd.MarkFlagRequired("project-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } dialogCmd.Flags().StringP("location-id", "l", "", "Dialogflow CX Location ID of the Project (required)") if err := dialogCmd.MarkFlagRequired("location-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } dialogCmd.Flags().StringP("agent-name", "a", "", "Dialogflow CX Agent Name (required)") if err := dialogCmd.MarkFlagRequired("agent-name"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } dialogCmd.Flags().StringP("locale", "e", "", "Locale of the intent. Default: agent locale (optional)") diff --git a/cmd/entitytype/create.go b/cmd/entitytype/create.go index 66154a73..fbcf5a90 100644 --- a/cmd/entitytype/create.go +++ b/cmd/entitytype/create.go @@ -26,7 +26,7 @@ var createCmd = &cobra.Command{ entityTypeName := args[0] if err := entitytype.Create(entityTypeName, locationID, projectID, agentName, localeId, entities, redacted); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } }, @@ -42,22 +42,22 @@ func init() { createCmd.Flags().StringP("agent-name", "a", "", "Dialogflow CX Agent Name (required)") if err := createCmd.MarkFlagRequired("agent-name"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } createCmd.Flags().StringP("project-id", "p", "", "Dialogflow CX Project ID (required)") if err := createCmd.MarkFlagRequired("project-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } createCmd.Flags().StringP("location-id", "l", "", "Dialogflow CX Location ID of the Project (required)") if err := createCmd.MarkFlagRequired("location-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } createCmd.Flags().StringSliceP("entities", "n", []string{}, "List of the entities for this entity type, comma separated. Format: entity1@synonym1|synonym2,entity2@synonym1|synonym2. Example: pikachu@25|pika,charmander@3 (required)") if err := createCmd.MarkFlagRequired("entities"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } diff --git a/cmd/entitytype/delete.go b/cmd/entitytype/delete.go index 44ee61ad..30d441e1 100644 --- a/cmd/entitytype/delete.go +++ b/cmd/entitytype/delete.go @@ -24,7 +24,7 @@ var deleteCmd = &cobra.Command{ entityTypeName := args[0] if err := entitytype.Delete(entityTypeName, locationID, projectID, agentName, force); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } }, @@ -40,17 +40,17 @@ func init() { deleteCmd.Flags().StringP("agent-name", "a", "", "Dialogflow CX Agent Name (required)") if err := deleteCmd.MarkFlagRequired("agent-name"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } deleteCmd.Flags().StringP("project-id", "p", "", "Dialogflow CX Project ID (required)") if err := deleteCmd.MarkFlagRequired("project-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } deleteCmd.Flags().StringP("location-id", "l", "", "Dialogflow CX Location ID of the Project (required)") if err := deleteCmd.MarkFlagRequired("location-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } deleteCmd.Flags().StringP("force", "f", "", "Forces to delete the Entity type. NOTE: it will delete all any references to the entity type. Possible values: true or false (optional)") diff --git a/cmd/entitytype/update.go b/cmd/entitytype/update.go index 815f2692..93f9a833 100644 --- a/cmd/entitytype/update.go +++ b/cmd/entitytype/update.go @@ -26,7 +26,7 @@ var updateCmd = &cobra.Command{ entityTypeName := args[0] if err := entitytype.Update(entityTypeName, locationID, projectID, agentName, localeId, entities, redacted); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } }, @@ -42,22 +42,22 @@ func init() { updateCmd.Flags().StringP("agent-name", "a", "", "Dialogflow CX Agent Name (required)") if err := updateCmd.MarkFlagRequired("agent-name"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } updateCmd.Flags().StringP("project-id", "p", "", "Dialogflow CX Project ID (required)") if err := updateCmd.MarkFlagRequired("project-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } updateCmd.Flags().StringP("location-id", "l", "", "Dialogflow CX Location ID of the Project (required)") if err := updateCmd.MarkFlagRequired("location-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } updateCmd.Flags().StringSliceP("entities", "n", []string{}, "List of the entities for this entity type, comma separated. Format: entity1@synonym1|synonym2,entity2@synonym1|synonym2. Example: pikachu@25|pika,charmander@3 (required)") if err := updateCmd.MarkFlagRequired("entities"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } diff --git a/cmd/environment/create.go b/cmd/environment/create.go index 713eab84..ddf107da 100644 --- a/cmd/environment/create.go +++ b/cmd/environment/create.go @@ -25,7 +25,7 @@ var createCmd = &cobra.Command{ name := args[0] if err := environment.Create(name, description, locationID, projectID, agentName, flowVersions); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } }, @@ -41,22 +41,22 @@ func init() { createCmd.Flags().StringSliceP("flow-versions", "s", []string{}, "List of Flow and its version to be added to this environment, comma separated. Format: flowName1@version1,flowName2|version2. Example: Default Start Flow@v1.0.0|Buy Flow@v1.0.1 (required)") if err := createCmd.MarkFlagRequired("flow-versions"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } createCmd.Flags().StringP("agent-name", "a", "", "Dialogflow CX Agent Name (required)") if err := createCmd.MarkFlagRequired("agent-name"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } createCmd.Flags().StringP("project-id", "p", "", "Dialogflow CX Project ID (required)") if err := createCmd.MarkFlagRequired("project-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } createCmd.Flags().StringP("location-id", "l", "", "Dialogflow CX Location ID of the Project (required)") if err := createCmd.MarkFlagRequired("location-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } createCmd.Flags().StringP("description", "d", "", "Description for this environment (optional)") diff --git a/cmd/environment/delete.go b/cmd/environment/delete.go index f3a25b67..b695c29e 100644 --- a/cmd/environment/delete.go +++ b/cmd/environment/delete.go @@ -23,7 +23,7 @@ var deleteCmd = &cobra.Command{ name := args[0] if err := environment.Delete(name, locationID, projectID, agentName); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } }, @@ -39,17 +39,17 @@ func init() { deleteCmd.Flags().StringP("agent-name", "a", "", "Dialogflow CX Agent Name (required)") if err := deleteCmd.MarkFlagRequired("agent-name"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } deleteCmd.Flags().StringP("project-id", "p", "", "Dialogflow CX Project ID (required)") if err := deleteCmd.MarkFlagRequired("project-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } deleteCmd.Flags().StringP("location-id", "l", "", "Dialogflow CX Location ID of the Project (required)") if err := deleteCmd.MarkFlagRequired("location-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } diff --git a/cmd/environment/execute.go b/cmd/environment/execute.go index 9d393a6a..b4f5fb3e 100644 --- a/cmd/environment/execute.go +++ b/cmd/environment/execute.go @@ -23,7 +23,7 @@ var executeCicdCmd = &cobra.Command{ envName := args[0] if err := environment.ExecutePipeline(envName, locationID, projectID, agentName); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } }, @@ -39,17 +39,17 @@ func init() { executeCicdCmd.Flags().StringP("agent-name", "a", "", "Dialogflow CX Agent Name (required)") if err := executeCicdCmd.MarkFlagRequired("agent-name"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } executeCicdCmd.Flags().StringP("project-id", "p", "", "Dialogflow CX Project ID (required)") if err := executeCicdCmd.MarkFlagRequired("project-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } executeCicdCmd.Flags().StringP("location-id", "l", "", "Dialogflow CX Location ID of the Project (required)") if err := executeCicdCmd.MarkFlagRequired("location-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } diff --git a/cmd/environment/update.go b/cmd/environment/update.go index 1ae2bcbf..88c4f747 100644 --- a/cmd/environment/update.go +++ b/cmd/environment/update.go @@ -26,7 +26,7 @@ var updateCmd = &cobra.Command{ name := args[0] if err := environment.Update(name, description, locationID, projectID, agentName, flowVersions); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } }, @@ -42,22 +42,22 @@ func init() { updateCmd.Flags().StringSliceP("flow-versions", "s", []string{}, "List of Flow and its version to be added to this environment, comma separated. Format: flowName1@version1,flowName2|version2. Example: Default Start Flow@v1.0.0|Buy Flow@v1.0.1 (required)") if err := updateCmd.MarkFlagRequired("flow-versions"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } updateCmd.Flags().StringP("agent-name", "a", "", "Dialogflow CX Agent Name (required)") if err := updateCmd.MarkFlagRequired("agent-name"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } updateCmd.Flags().StringP("project-id", "p", "", "Dialogflow CX Project ID (required)") if err := updateCmd.MarkFlagRequired("project-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } updateCmd.Flags().StringP("location-id", "l", "", "Dialogflow CX Location ID of the Project (required)") if err := updateCmd.MarkFlagRequired("location-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } updateCmd.Flags().StringP("description", "d", "", "Description for this environment (optional)") diff --git a/cmd/flow/create.go b/cmd/flow/create.go index 376cbffc..00af438e 100644 --- a/cmd/flow/create.go +++ b/cmd/flow/create.go @@ -28,7 +28,7 @@ var createCmd = &cobra.Command{ flowName := args[0] if err := flow.Create(flowName, description, locationID, projectID, agentName, localeId, nluClassificationThreshold, nluModelType, nluModelTrainingMode); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } }, @@ -44,17 +44,17 @@ func init() { createCmd.Flags().StringP("project-id", "p", "", "Dialogflow CX Project ID (required)") if err := createCmd.MarkFlagRequired("project-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } createCmd.Flags().StringP("location-id", "l", "", "Dialogflow CX Location ID of the Project (required)") if err := createCmd.MarkFlagRequired("location-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } createCmd.Flags().StringP("agent-name", "a", "", "Dialogflow CX Agent Name (required)") if err := createCmd.MarkFlagRequired("agent-name"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } createCmd.Flags().StringP("locale", "e", "", "Locale of the flow. Default: agent locale (optional)") diff --git a/cmd/flow/delete.go b/cmd/flow/delete.go index 1a8c5692..9bff09e4 100644 --- a/cmd/flow/delete.go +++ b/cmd/flow/delete.go @@ -23,7 +23,7 @@ var deleteCmd = &cobra.Command{ flowName := args[0] if err := flow.Delete(flowName, locationID, projectID, agentName); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } }, @@ -39,17 +39,17 @@ func init() { deleteCmd.Flags().StringP("project-id", "p", "", "Dialogflow CX Project ID (required)") if err := deleteCmd.MarkFlagRequired("project-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } deleteCmd.Flags().StringP("location-id", "l", "", "Dialogflow CX Location ID of the Project (required)") if err := deleteCmd.MarkFlagRequired("location-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } deleteCmd.Flags().StringP("agent-name", "a", "", "Dialogflow CX Agent Name (required)") if err := deleteCmd.MarkFlagRequired("agent-name"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } } diff --git a/cmd/flow/train.go b/cmd/flow/train.go index 71cbfd07..1192bcf3 100644 --- a/cmd/flow/train.go +++ b/cmd/flow/train.go @@ -23,7 +23,7 @@ var trainCmd = &cobra.Command{ flowName := args[0] if err := flow.Train(flowName, locationID, projectID, agentName); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } }, @@ -39,17 +39,17 @@ func init() { trainCmd.Flags().StringP("project-id", "p", "", "Dialogflow CX Project ID (required)") if err := trainCmd.MarkFlagRequired("project-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } trainCmd.Flags().StringP("location-id", "l", "", "Dialogflow CX Location ID of the Project (required)") if err := trainCmd.MarkFlagRequired("location-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } trainCmd.Flags().StringP("agent-name", "a", "", "Dialogflow CX Agent Name (required)") if err := trainCmd.MarkFlagRequired("agent-name"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } } diff --git a/cmd/flow/update.go b/cmd/flow/update.go index 6a809489..2018e050 100644 --- a/cmd/flow/update.go +++ b/cmd/flow/update.go @@ -28,7 +28,7 @@ var updateCmd = &cobra.Command{ flowName := args[0] if err := flow.Update(flowName, description, locationID, projectID, agentName, localeId, nluClassificationThreshold, nluModelType, nluModelTrainingMode); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } }, @@ -44,17 +44,17 @@ func init() { updateCmd.Flags().StringP("project-id", "p", "", "Dialogflow CX Project ID (required)") if err := updateCmd.MarkFlagRequired("project-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } updateCmd.Flags().StringP("location-id", "l", "", "Dialogflow CX Location ID of the Project (required)") if err := updateCmd.MarkFlagRequired("location-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } updateCmd.Flags().StringP("agent-name", "a", "", "Dialogflow CX Agent Name (required)") if err := updateCmd.MarkFlagRequired("agent-name"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } updateCmd.Flags().StringP("locale", "e", "", "Locale of the flow. Default: agent locale (optional)") diff --git a/cmd/flowversion/create.go b/cmd/flowversion/create.go index ebc8d967..aec5f1e4 100644 --- a/cmd/flowversion/create.go +++ b/cmd/flowversion/create.go @@ -25,7 +25,7 @@ var createCmd = &cobra.Command{ name := args[0] if err := flowversion.Create(name, description, startFlow, locationID, projectID, agentName); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } }, @@ -41,22 +41,22 @@ func init() { createCmd.Flags().StringP("start-flow", "s", "", "Start Flow name to create the version (required)") if err := createCmd.MarkFlagRequired("start-flow"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } createCmd.Flags().StringP("project-id", "p", "", "Dialogflow CX Project ID (required)") if err := createCmd.MarkFlagRequired("project-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } createCmd.Flags().StringP("location-id", "l", "", "Dialogflow CX Location ID of the Project (required)") if err := createCmd.MarkFlagRequired("location-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } createCmd.Flags().StringP("agent-name", "a", "", "Dialogflow CX Agent Name (required)") if err := createCmd.MarkFlagRequired("agent-name"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } createCmd.Flags().StringP("description", "d", "", "Description for this version (optional)") diff --git a/cmd/flowversion/delete.go b/cmd/flowversion/delete.go index 9d62ee17..f5bd2b07 100644 --- a/cmd/flowversion/delete.go +++ b/cmd/flowversion/delete.go @@ -24,7 +24,7 @@ var deleteCmd = &cobra.Command{ name := args[0] if err := flowversion.Delete(name, startFlow, locationID, projectID, agentName); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } }, @@ -40,22 +40,22 @@ func init() { deleteCmd.Flags().StringP("start-flow", "s", "", "Start Flow name to create the version (required)") if err := deleteCmd.MarkFlagRequired("start-flow"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } deleteCmd.Flags().StringP("project-id", "p", "", "Dialogflow CX Project ID (required)") if err := deleteCmd.MarkFlagRequired("project-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } deleteCmd.Flags().StringP("location-id", "l", "", "Dialogflow CX Location ID of the Project (required)") if err := deleteCmd.MarkFlagRequired("location-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } deleteCmd.Flags().StringP("agent-name", "a", "", "Dialogflow CX Agent Name (required)") if err := deleteCmd.MarkFlagRequired("agent-name"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } diff --git a/cmd/flowversion/update.go b/cmd/flowversion/update.go index 906b2601..1a488696 100644 --- a/cmd/flowversion/update.go +++ b/cmd/flowversion/update.go @@ -25,7 +25,7 @@ var updateCmd = &cobra.Command{ name := args[0] if err := flowversion.Update(name, description, startFlow, locationID, projectID, agentName); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } }, @@ -41,22 +41,22 @@ func init() { updateCmd.Flags().StringP("start-flow", "s", "", "Start Flow name to create the version (required)") if err := updateCmd.MarkFlagRequired("start-flow"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } updateCmd.Flags().StringP("project-id", "p", "", "Dialogflow CX Project ID (required)") if err := updateCmd.MarkFlagRequired("project-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } updateCmd.Flags().StringP("location-id", "l", "", "Dialogflow CX Location ID of the Project (required)") if err := updateCmd.MarkFlagRequired("location-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } updateCmd.Flags().StringP("agent-name", "a", "", "Dialogflow CX Agent Name (required)") if err := updateCmd.MarkFlagRequired("agent-name"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } updateCmd.Flags().StringP("description", "d", "", "Description for this version (optional)") diff --git a/cmd/generator/create.go b/cmd/generator/create.go index b92297cf..e104f21b 100644 --- a/cmd/generator/create.go +++ b/cmd/generator/create.go @@ -25,7 +25,7 @@ var createCmd = &cobra.Command{ name := args[0] if err := generator.Create(name, locationID, projectID, agentName, prompt, localeId); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } }, @@ -41,23 +41,23 @@ func init() { createCmd.Flags().StringP("prompt", "r", "", "Prompt (required)") if err := createCmd.MarkFlagRequired("prompt"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } createCmd.Flags().StringP("project-id", "p", "", "Dialogflow CX Project ID (required)") if err := createCmd.MarkFlagRequired("project-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } createCmd.Flags().StringP("location-id", "l", "", "Dialogflow CX Location ID of the Project (required)") if err := createCmd.MarkFlagRequired("location-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } createCmd.Flags().StringP("agent-name", "a", "", "Dialogflow CX Agent Name (required)") if err := createCmd.MarkFlagRequired("agent-name"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } diff --git a/cmd/generator/delete.go b/cmd/generator/delete.go index d4fa2e99..1db2ad70 100644 --- a/cmd/generator/delete.go +++ b/cmd/generator/delete.go @@ -24,7 +24,7 @@ var deleteCmd = &cobra.Command{ name := args[0] if err := generator.Delete(name, locationID, projectID, agentName, force); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } }, @@ -40,17 +40,17 @@ func init() { deleteCmd.Flags().StringP("project-id", "p", "", "Dialogflow CX Project ID (required)") if err := deleteCmd.MarkFlagRequired("project-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } deleteCmd.Flags().StringP("location-id", "l", "", "Dialogflow CX Location ID of the Project (required)") if err := deleteCmd.MarkFlagRequired("location-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } deleteCmd.Flags().StringP("agent-name", "a", "", "Dialogflow CX Agent Name (required)") if err := deleteCmd.MarkFlagRequired("agent-name"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } deleteCmd.Flags().StringP("force", "f", "", "Forces to delete the generator and its references. Possible values: true or false (optional)") diff --git a/cmd/generator/update.go b/cmd/generator/update.go index 3a8e46e1..9f8b80bb 100644 --- a/cmd/generator/update.go +++ b/cmd/generator/update.go @@ -25,7 +25,7 @@ var updateCmd = &cobra.Command{ name := args[0] if err := generator.Update(name, locationID, projectID, agentName, prompt, localeId); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } }, @@ -41,22 +41,22 @@ func init() { updateCmd.Flags().StringP("prompt", "r", "", "Prompt (required)") if err := updateCmd.MarkFlagRequired("prompt"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } updateCmd.Flags().StringP("project-id", "p", "", "Dialogflow CX Project ID (required)") if err := updateCmd.MarkFlagRequired("project-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } updateCmd.Flags().StringP("location-id", "l", "", "Dialogflow CX Location ID of the Project (required)") if err := updateCmd.MarkFlagRequired("location-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } updateCmd.Flags().StringP("agent-name", "a", "", "Dialogflow CX Agent Name (required)") if err := updateCmd.MarkFlagRequired("agent-name"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } diff --git a/cmd/intent/create.go b/cmd/intent/create.go index 0804b782..a9c5a15e 100644 --- a/cmd/intent/create.go +++ b/cmd/intent/create.go @@ -26,7 +26,7 @@ var createCmd = &cobra.Command{ intentName := args[0] if err := intent.Create(intentName, description, locationID, projectID, agentName, localeId, trainingPhrases); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } }, @@ -42,22 +42,22 @@ func init() { createCmd.Flags().StringP("project-id", "p", "", "Dialogflow CX Project ID (required)") if err := createCmd.MarkFlagRequired("project-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } createCmd.Flags().StringP("location-id", "l", "", "Dialogflow CX Location ID of the Project (required)") if err := createCmd.MarkFlagRequired("location-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } createCmd.Flags().StringP("agent-name", "a", "", "Dialogflow CX Agent Name (required)") if err := createCmd.MarkFlagRequired("agent-name"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } createCmd.Flags().StringSliceP("training-phrases", "t", []string{}, "List of the training phrases for this intent, comma separated. Entities, add @entity-type to the word: word@entity-type in the training phrase. Example: hello,hi how are you today@sys.date,morning!. (required)") if err := createCmd.MarkFlagRequired("training-phrases"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } createCmd.Flags().StringP("locale", "e", "", "Locale of the intent. Default: agent locale (optional)") diff --git a/cmd/intent/delete.go b/cmd/intent/delete.go index 6c43a960..8ff94998 100644 --- a/cmd/intent/delete.go +++ b/cmd/intent/delete.go @@ -23,7 +23,7 @@ var deleteCmd = &cobra.Command{ intentName := args[0] if err := intent.Delete(intentName, locationID, projectID, agentName); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } }, @@ -39,17 +39,17 @@ func init() { deleteCmd.Flags().StringP("project-id", "p", "", "Dialogflow CX Project ID (required)") if err := deleteCmd.MarkFlagRequired("project-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } deleteCmd.Flags().StringP("location-id", "l", "", "Dialogflow CX Location ID of the Project (required)") if err := deleteCmd.MarkFlagRequired("location-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } deleteCmd.Flags().StringP("agent-name", "a", "", "Dialogflow CX Agent Name (required)") if err := deleteCmd.MarkFlagRequired("agent-name"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } } diff --git a/cmd/intent/update.go b/cmd/intent/update.go index 31e9ceac..0c1b6c54 100644 --- a/cmd/intent/update.go +++ b/cmd/intent/update.go @@ -26,7 +26,7 @@ var updateCmd = &cobra.Command{ intentName := args[0] if err := intent.Update(intentName, description, locationID, projectID, agentName, localeId, trainingPhrases); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } }, @@ -42,17 +42,17 @@ func init() { updateCmd.Flags().StringP("project-id", "p", "", "Dialogflow CX Project ID (required)") if err := updateCmd.MarkFlagRequired("project-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } updateCmd.Flags().StringP("location-id", "l", "", "Dialogflow CX Location ID of the Project (required)") if err := updateCmd.MarkFlagRequired("location-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } updateCmd.Flags().StringP("agent-name", "a", "", "Dialogflow CX Agent Name (required)") if err := updateCmd.MarkFlagRequired("agent-name"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } updateCmd.Flags().StringP("locale", "e", "", "Locale of the intent. Default: agent locale (optional)") diff --git a/cmd/profileconversation/execute.go b/cmd/profileconversation/execute.go index 6f4a385f..5f082f6e 100644 --- a/cmd/profileconversation/execute.go +++ b/cmd/profileconversation/execute.go @@ -20,7 +20,7 @@ var executeCmd = &cobra.Command{ suite := args[0] if err := profileconversation.ExecuteSuite(suite); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } }, diff --git a/cmd/profilenlu/execute.go b/cmd/profilenlu/execute.go index f6136611..92b65494 100644 --- a/cmd/profilenlu/execute.go +++ b/cmd/profilenlu/execute.go @@ -20,7 +20,7 @@ var executeCmd = &cobra.Command{ suite := args[0] if err := profilenlu.ExecuteSuite(suite); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } }, diff --git a/cmd/root.go b/cmd/root.go index 821ddc01..c3e1dc10 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -5,7 +5,6 @@ import ( "github.com/pkg/errors" "github.com/spf13/cobra" - cobracompletefig "github.com/withfig/autocomplete-tools/integrations/cobra" cmdagent "github.com/xavidop/dialogflow-cx-cli/cmd/agent" "github.com/xavidop/dialogflow-cx-cli/cmd/cmdutils" cmdentitytype "github.com/xavidop/dialogflow-cx-cli/cmd/entitytype" diff --git a/cmd/stt/recognize.go b/cmd/stt/recognize.go index 25e27d4b..33cb9b9d 100644 --- a/cmd/stt/recognize.go +++ b/cmd/stt/recognize.go @@ -21,7 +21,7 @@ var recognizeCmd = &cobra.Command{ input := args[0] if err := stt.Recognize(input, locale); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } }, @@ -37,7 +37,7 @@ func init() { recognizeCmd.Flags().StringP("locale", "l", "", "Input locale (required)") if err := recognizeCmd.MarkFlagRequired("locale"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } } diff --git a/cmd/tts/synthesize.go b/cmd/tts/synthesize.go index 450163cb..d8f2e131 100644 --- a/cmd/tts/synthesize.go +++ b/cmd/tts/synthesize.go @@ -23,7 +23,7 @@ var synthesizeCmd = &cobra.Command{ output, _ := cmd.Flags().GetString("output-file") if err := tts.Synthesize(input, locale, output); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } }, @@ -39,7 +39,7 @@ func init() { synthesizeCmd.Flags().StringP("locale", "l", "", "Input locale (required)") if err := synthesizeCmd.MarkFlagRequired("locale"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } synthesizeCmd.Flags().StringP("output-file", "f", "output.mp3", "Output file name. Default: output.mp3 (optional)") diff --git a/cmd/webhook/create.go b/cmd/webhook/create.go index 277ff9da..1f842984 100644 --- a/cmd/webhook/create.go +++ b/cmd/webhook/create.go @@ -28,7 +28,7 @@ var createCmd = &cobra.Command{ name := args[0] if err := webhook.Create(name, url, locationID, projectID, agentName, environment, flexible, requestBody, parametersMapping); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } }, @@ -44,22 +44,22 @@ func init() { createCmd.Flags().StringP("url", "r", "", "Webhook URL (required)") if err := createCmd.MarkFlagRequired("url"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } createCmd.Flags().StringP("project-id", "p", "", "Dialogflow CX Project ID (required)") if err := createCmd.MarkFlagRequired("project-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } createCmd.Flags().StringP("location-id", "l", "", "Dialogflow CX Location ID of the Project (required)") if err := createCmd.MarkFlagRequired("location-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } createCmd.Flags().StringP("agent-name", "a", "", "Dialogflow CX Agent Name (required)") if err := createCmd.MarkFlagRequired("agent-name"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } createCmd.Flags().StringP("environment", "e", "global", "Environment where you want to set the webhook url. Default: global (optional)") diff --git a/cmd/webhook/delete.go b/cmd/webhook/delete.go index 1914f4de..6a38e9df 100644 --- a/cmd/webhook/delete.go +++ b/cmd/webhook/delete.go @@ -24,7 +24,7 @@ var deleteCmd = &cobra.Command{ name := args[0] if err := webhook.Delete(name, locationID, projectID, agentName, force); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } }, @@ -40,17 +40,17 @@ func init() { deleteCmd.Flags().StringP("project-id", "p", "", "Dialogflow CX Project ID (required)") if err := deleteCmd.MarkFlagRequired("project-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } deleteCmd.Flags().StringP("location-id", "l", "", "Dialogflow CX Location ID of the Project (required)") if err := deleteCmd.MarkFlagRequired("location-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } deleteCmd.Flags().StringP("agent-name", "a", "", "Dialogflow CX Agent Name (required)") if err := deleteCmd.MarkFlagRequired("agent-name"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } deleteCmd.Flags().StringP("force", "f", "", "Forces to delete the webhook and its references in environments and flows. Possible values: true or false (optional)") diff --git a/cmd/webhook/update.go b/cmd/webhook/update.go index 5186875d..b7bc84f9 100644 --- a/cmd/webhook/update.go +++ b/cmd/webhook/update.go @@ -28,7 +28,7 @@ var updateCmd = &cobra.Command{ name := args[0] if err := webhook.Update(name, url, locationID, projectID, agentName, environment, flexible, requestBody, parametersMapping); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } }, @@ -44,22 +44,22 @@ func init() { updateCmd.Flags().StringP("url", "r", "", "Webhook URL (required)") if err := updateCmd.MarkFlagRequired("url"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } updateCmd.Flags().StringP("project-id", "p", "", "Dialogflow CX Project ID (required)") if err := updateCmd.MarkFlagRequired("project-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } updateCmd.Flags().StringP("location-id", "l", "", "Dialogflow CX Location ID of the Project (required)") if err := updateCmd.MarkFlagRequired("location-id"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } updateCmd.Flags().StringP("agent-name", "a", "", "Dialogflow CX Agent Name (required)") if err := updateCmd.MarkFlagRequired("agent-name"); err != nil { - global.Log.Errorf(err.Error()) + global.Log.Errorf("%s", err.Error()) os.Exit(1) } updateCmd.Flags().StringP("environment", "e", "global", "Environment where you want to set the webhook url. Default: global (optional)") diff --git a/go.mod b/go.mod index 2df1c98b..0c581eb3 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,8 @@ module github.com/xavidop/dialogflow-cx-cli -go 1.21 +go 1.23 -toolchain go1.21.5 +toolchain go1.23.4 require ( cloud.google.com/go/dialogflow v1.64.0 @@ -23,7 +23,6 @@ require ( github.com/muesli/mango-cobra v1.2.0 github.com/muesli/roff v0.1.0 github.com/tmc/langchaingo v0.1.3 - github.com/withfig/autocomplete-tools/integrations/cobra v1.2.1 golang.org/x/exp v0.0.0-20231206192017-f3f8817b8deb golang.org/x/term v0.27.0 google.golang.org/protobuf v1.36.1 diff --git a/go.sum b/go.sum index 5e5b9107..0b18f328 100644 --- a/go.sum +++ b/go.sum @@ -101,8 +101,6 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/tmc/langchaingo v0.1.3 h1:QIzyhr5N2ZkE1z/9QJUBD+t9JndMrnXwIFw2I7FYtA8= github.com/tmc/langchaingo v0.1.3/go.mod h1:Rm4WfxQR0WQLtcz5+zMGutlfgMuNY5QKZt8k3Y42gz0= -github.com/withfig/autocomplete-tools/integrations/cobra v1.2.1 h1:+dBg5k7nuTE38VVdoroRsT0Z88fmvdYrI2EjzJst35I= -github.com/withfig/autocomplete-tools/integrations/cobra v1.2.1/go.mod h1:nmuySobZb4kFgFy6BptpXp/BBw+xFSyvVPP6auoJB4k= github.com/wk8/go-ordered-map/v2 v2.1.8 h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/fJgbpc= github.com/wk8/go-ordered-map/v2 v2.1.8/go.mod h1:5nJHM5DyteebpVlHnWMV0rPz6Zp7+xBAnxjb1X5vnTw= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0 h1:r6I7RJCN86bpD/FQwedZ0vSixDpwuWREjW9oRMsmqDc= diff --git a/pkg/environment/execute-cicd.go b/pkg/environment/execute-cicd.go index 2bc59cb0..b147ed60 100644 --- a/pkg/environment/execute-cicd.go +++ b/pkg/environment/execute-cicd.go @@ -39,7 +39,7 @@ func ExecutePipeline(envName string, locationID string, projectID string, agentN return err } - global.Log.Infof(result.GetResult().String()) + global.Log.Infof("%s", result.GetResult().String()) return nil } diff --git a/pkg/profileconversation/execute.go b/pkg/profileconversation/execute.go index 787eb5fd..77737561 100644 --- a/pkg/profileconversation/execute.go +++ b/pkg/profileconversation/execute.go @@ -97,25 +97,25 @@ func ExecuteSuite(suiteFile string) error { switch validation.Type { case "contains": if err := executeContains(validation, responseText, validationLog); err != nil { - validationLog.Errorf(err.Error()) + validationLog.Errorf("%s", err.Error()) errstrings = append(errstrings, err.Error()) continue } case "regexp": if err := executeRegexp(validation, responseText, validationLog); err != nil { - validationLog.Errorf(err.Error()) + validationLog.Errorf("%s", err.Error()) errstrings = append(errstrings, err.Error()) continue } case "equals": if err := executeEquals(validation, responseText, validationLog); err != nil { - validationLog.Errorf(err.Error()) + validationLog.Errorf("%s", err.Error()) errstrings = append(errstrings, err.Error()) continue } case "similarity": if err := executeSimilarity(validation, responseText, validationLog); err != nil { - validationLog.Errorf(err.Error()) + validationLog.Errorf("%s", err.Error()) errstrings = append(errstrings, err.Error()) continue } diff --git a/pkg/profilenlu/execute.go b/pkg/profilenlu/execute.go index f63da81a..d787a4e0 100644 --- a/pkg/profilenlu/execute.go +++ b/pkg/profilenlu/execute.go @@ -95,7 +95,7 @@ func ExecuteSuite(suiteFile string) error { if check.Validate.Intent != intentDetected { intentError := fmt.Errorf("intent \"%s\" does not match with the intent detected \"%s\"", check.Validate.Intent, intentDetected) - validationLog.Errorf(intentError.Error()) + validationLog.Errorf("%s", intentError.Error()) errstrings = append(errstrings, intentError.Error()) continue } @@ -112,7 +112,7 @@ func ExecuteSuite(suiteFile string) error { } if param.Value != extractedValue { parameterError := fmt.Errorf("parameter value \"%s\" does not match with the parameter detected \"%s\"", param.Value, extractedValue) - validationLog.Errorf(parameterError.Error()) + validationLog.Errorf("%s", parameterError.Error()) errstrings = append(errstrings, parameterError.Error()) } parameters = types.RemoveParameterByName(parameters, param.Parameter) @@ -121,7 +121,7 @@ func ExecuteSuite(suiteFile string) error { if len(parameters) > 0 { parametersNotDetectedError := fmt.Errorf("parameters not detected: %v", parameters) - validationLog.Errorf(parametersNotDetectedError.Error()) + validationLog.Errorf("%s", parametersNotDetectedError.Error()) errstrings = append(errstrings, parametersNotDetectedError.Error()) } }