Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix meshkit error utility failing to run. #38

Merged
merged 1 commit into from
Oct 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -23,11 +23,11 @@ all: dep-check build

## Analyze error codes
error: dep-check
go run github.com/layer5io/meshkit/cmd/errorutil -d ../internal/errors analyze -i . -o .
go run github.com/layer5io/meshkit/cmd/errorutil -d . analyze -i ./build -o ./build

## Runs meshkit error utility to update error codes.
error-util:
go run github.com/layer5io/meshkit/cmd/errorutil -d ../internal/errors update -i . -o .
go run github.com/layer5io/meshkit/cmd/errorutil -d . update -i ./build -o ./build



4 changes: 2 additions & 2 deletions build/component_info.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "helm-kanvas-snapshot",
"name": "kanvas-snapshot",
"type": "component",
"next_error_code": 1000
"next_error_code": 1006
}
11 changes: 6 additions & 5 deletions internal/errors/error.go
Original file line number Diff line number Diff line change
@@ -5,11 +5,12 @@ import (
)

var (
ErrInvalidChartURICode = "kanvas-snapshot-900"
ErrCreatingMesheryDesignCode = "kanvas-snapshot-901"
ErrGeneratingSnapshotCode = "kanvas-snapshot-902"
ErrHTTPPostRequestCode = "kanvas-snapshot-903"
ErrDecodingAPICode = "kanvas-snapshot-905"
ErrInvalidChartURICode = "kanvas-snapshot-1000"
ErrCreatingMesheryDesignCode = "kanvas-snapshot-1001"
ErrGeneratingSnapshotCode = "kanvas-snapshot-1002"
ErrHTTPPostRequestCode = "kanvas-snapshot-1003"
ErrDecodingAPICode = "kanvas-snapshot-1004"
ErrRequiredFieldNotProvidedCode = "kanvas-snapshot-1005"
)

func ErrInvalidChartURI(err error) error {

Unchanged files with check annotations Beta

defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
io.ReadAll(resp.Body)

Check failure on line 177 in cmd/kanvas-snapshot/main.go

GitHub Actions / golangci-lint

Error return value of `io.ReadAll` is not checked (errcheck)
return "", err
}
// Expecting a JSON array in the response
generateKanvasSnapshotCmd.Flags().StringVarP(&designName, "design-name", "l", "", "Optional name for the Meshery design")
generateKanvasSnapshotCmd.Flags().StringVarP(&email, "email", "e", "", "Optional email to associate with the Meshery design")
generateKanvasSnapshotCmd.MarkFlagRequired("file")

Check failure on line 253 in cmd/kanvas-snapshot/main.go

GitHub Actions / golangci-lint

Error return value of `generateKanvasSnapshotCmd.MarkFlagRequired` is not checked (errcheck)
generateKanvasSnapshotCmd.MarkFlagRequired("email")

Check failure on line 254 in cmd/kanvas-snapshot/main.go

GitHub Actions / golangci-lint

Error return value of `generateKanvasSnapshotCmd.MarkFlagRequired` is not checked (errcheck)
if err := generateKanvasSnapshotCmd.Execute(); err != nil {
LogError.Error(err)