Skip to content

Commit

Permalink
Merge pull request #57 from theBeginner86/thebeginner86/chore/lint
Browse files Browse the repository at this point in the history
[chore] Fix failing lint
  • Loading branch information
leecalcote authored Nov 10, 2024
2 parents 9d4a3db + ad63130 commit 3018730
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions cmd/kanvas-snapshot/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (

var (
ProviderToken string
MesheryApiBaseUrl string
MesheryCloudApiBaseUrl string
MesheryAPIBaseURL string
MesheryCloudAPIBaseURL string
Log logger.Handler
)

Expand Down Expand Up @@ -51,7 +51,7 @@ var generateKanvasSnapshotCmd = &cobra.Command{
-e, --email string email address to notify when snapshot is ready (required)
-h Help for Helm Kanvas Snapshot plugin`,

RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, _ []string) error {
// Use the extracted name from URI if not provided
if designName == "" {
designName = ExtractNameFromURI(chartURI)
Expand Down Expand Up @@ -156,7 +156,7 @@ func CreateMesheryDesign(uri, name, email string) (string, error) {

sourceType := "Helm Chart"
encodedChartType := url.PathEscape(sourceType)
fullURL := fmt.Sprintf("%s/api/pattern/%s", MesheryApiBaseUrl, encodedChartType)
fullURL := fmt.Sprintf("%s/api/pattern/%s", MesheryAPIBaseURL, encodedChartType)

// Create the request
req, err := http.NewRequest("POST", fullURL, bytes.NewBuffer(payloadBytes))
Expand All @@ -167,8 +167,8 @@ func CreateMesheryDesign(uri, name, email string) (string, error) {

// Set headers and log them
req.Header.Set("Cookie", ProviderToken)
req.Header.Set("Origin", MesheryApiBaseUrl)
req.Header.Set("Host", MesheryApiBaseUrl)
req.Header.Set("Origin", MesheryAPIBaseURL)
req.Header.Set("Host", MesheryAPIBaseURL)
req.Header.Set("Content-Type", "text/plain;charset=UTF-8")
req.Header.Set("Accept-Encoding", "gzip, deflate, br, zstd")
req.Header.Set("Accept-Language", "en-GB,en-US;q=0.9,en;q=0.8")
Expand Down Expand Up @@ -205,7 +205,7 @@ func CreateMesheryDesign(uri, name, email string) (string, error) {
return "", errors.ErrCreatingMesheryDesign(fmt.Errorf("failed to extract design ID from response"))
}

func GenerateSnapshot(designID, chartURI, email, assetLocation string) error {
func GenerateSnapshot(designID, _, email, assetLocation string) error {
payload := map[string]interface{}{
"Payload": map[string]string{
"application_type": "Helm Chart",
Expand All @@ -224,7 +224,7 @@ func GenerateSnapshot(designID, chartURI, email, assetLocation string) error {
// Create the POST request
req, err := http.NewRequest(
"POST",
fmt.Sprintf("%s/api/integrations/trigger/workflow", MesheryCloudApiBaseUrl),
fmt.Sprintf("%s/api/integrations/trigger/workflow", MesheryCloudAPIBaseURL),
bytes.NewBuffer(payloadBytes),
)
if err != nil {
Expand All @@ -233,7 +233,7 @@ func GenerateSnapshot(designID, chartURI, email, assetLocation string) error {

req.Header.Set("Cookie", ProviderToken)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Referer", fmt.Sprintf("%s/dashboard", MesheryCloudApiBaseUrl))
req.Header.Set("Referer", fmt.Sprintf("%s/dashboard", MesheryCloudAPIBaseURL))

client := &http.Client{}

Expand Down
4 changes: 2 additions & 2 deletions internal/errors/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ func ErrRequiredFieldNotProvided(err error, field string) error {
return errors.New(ErrRequiredFieldNotProvidedCode, errors.Alert,
[]string{"All required flags are not passed."},
[]string{err.Error()},
[]string{"Required flag \"%s\" is not passed."},
[]string{"Ensure value for flag \"%s\" is correctly provided."},
[]string{fmt.Sprintf("Required flag \"%s\" is not passed.", field)},
[]string{fmt.Sprintf("Ensure value for flag \"%s\" is correctly provided.", field)},
)
}

Expand Down

0 comments on commit 3018730

Please sign in to comment.