Skip to content

Commit

Permalink
chore(lint): satisfy the linter
Browse files Browse the repository at this point in the history
  • Loading branch information
Tieske committed Oct 10, 2023
1 parent 3ac36be commit 1bf65af
Show file tree
Hide file tree
Showing 16 changed files with 214 additions and 185 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ jobs:
uses: actions/checkout@v3
- name: Setup golangci-lint
uses: golangci/[email protected]
with:
args: --timeout=30m
- name: Verify Codegen
run: make verify-codegen
- name: Run tests with Coverage
Expand Down
31 changes: 17 additions & 14 deletions cmd/file_kong2kic.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@ import (
var (
cmdKong2KicInputFilename string
cmdKong2KicOutputFilename string
//cmdKong2KicApi string
cmdKong2KicOutputFormat string
cmdKong2KicManifestStyle string
// cmdKong2KicApi string
cmdKong2KicOutputFormat string
cmdKong2KicManifestStyle string
)

// Executes the CLI command "kong2kic"
func executeKong2Kic(cmd *cobra.Command, _ []string) error {

var (
outputContent *file.Content
err error
Expand All @@ -36,14 +35,18 @@ func executeKong2Kic(cmd *cobra.Command, _ []string) error {
}

outputContent = inputContent.DeepCopy()
if strings.ToUpper(cmdKong2KicOutputFormat) == "JSON" && strings.ToUpper(cmdKong2KicManifestStyle) == "CRD" {
outputFileFormat = file.KIC_JSON_CRD
} else if strings.ToUpper(cmdKong2KicOutputFormat) == "JSON" && strings.ToUpper(cmdKong2KicManifestStyle) == "ANNOTATION" {
outputFileFormat = file.KIC_JSON_ANNOTATION
} else if strings.ToUpper(cmdKong2KicOutputFormat) == "YAML" && strings.ToUpper(cmdKong2KicManifestStyle) == "CRD" {
outputFileFormat = file.KIC_YAML_CRD
} else if strings.ToUpper(cmdKong2KicOutputFormat) == "YAML" && strings.ToUpper(cmdKong2KicManifestStyle) == "ANNOTATION" {
outputFileFormat = file.KIC_YAML_ANNOTATION
if strings.ToUpper(cmdKong2KicOutputFormat) == "JSON" &&
strings.ToUpper(cmdKong2KicManifestStyle) == "CRD" {
outputFileFormat = file.KICJSONCrd
} else if strings.ToUpper(cmdKong2KicOutputFormat) == "JSON" &&
strings.ToUpper(cmdKong2KicManifestStyle) == "ANNOTATION" {
outputFileFormat = file.KICJSONAnnotation
} else if strings.ToUpper(cmdKong2KicOutputFormat) == "YAML" &&
strings.ToUpper(cmdKong2KicManifestStyle) == "CRD" {
outputFileFormat = file.KICYAMLCrd
} else if strings.ToUpper(cmdKong2KicOutputFormat) == "YAML" &&
strings.ToUpper(cmdKong2KicManifestStyle) == "ANNOTATION" {
outputFileFormat = file.KICYAMLAnnotation
} else {
return fmt.Errorf("invalid combination of output format and manifest style")
}
Expand Down Expand Up @@ -71,7 +74,7 @@ func newKong2KicCmd() *cobra.Command {
Manifests can be generated using annotations in Ingress and Service objects (recommended) or
using the KongIngress CRD. Output in YAML or JSON format.`,
RunE: executeKong2Kic,
RunE: executeKong2Kic,
Args: cobra.NoArgs,
}

Expand All @@ -83,7 +86,7 @@ using the KongIngress CRD. Output in YAML or JSON format.`,
"Generate manifests with annotations in Service and Ingress, or using the KongIngress CRD: annotation or crd.")
kong2KicCmd.Flags().StringVarP(&cmdKong2KicOutputFormat, "format", "f", "yaml",
"output file format: json or yaml.")
//kong2KicCmd.Flags().StringVarP(&cmdKong2KicApi, "api", "a", "ingress", "[ingress|gateway]")
// kong2KicCmd.Flags().StringVarP(&cmdKong2KicApi, "api", "a", "ingress", "[ingress|gateway]")

return kong2KicCmd
}
3 changes: 1 addition & 2 deletions convert/convert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ func TestParseFormat(t *testing.T) {
want: "",
wantErr: true,
},

}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down Expand Up @@ -470,4 +469,4 @@ func Test_convertKongGatewayToKonnect(t *testing.T) {
}
})
}
}
}
Loading

0 comments on commit 1bf65af

Please sign in to comment.