Skip to content

Commit a853ade

Browse files
refactor: naming conventions and errors handled to fix build issues
Signed-off-by: azar-writes-code <[email protected]>
1 parent ba773be commit a853ade

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
lines changed

cmd/customLicense.go renamed to cmd/custom-license.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package cmd
22

33
import (
4-
"github.com/intelops/compage/cmd/subcommand/customLicense"
4+
"github.com/intelops/compage/cmd/subcommand/customlicense"
55
"github.com/sirupsen/logrus"
66
)
77

@@ -14,8 +14,8 @@ func init() {
1414
})
1515

1616
// Create the instance for customlicense
17-
customlicense := customLicense.NewCustomLicenseCmd(logger)
17+
customLicense := customlicense.NewCustomLicenseCmd(logger)
1818

1919
// Add Subcommand for the root command
20-
rootCmd.AddCommand(customlicense.Execute())
20+
rootCmd.AddCommand(customLicense.Execute())
2121
}

cmd/subcommand/customLicense/constants.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package customLicense
1+
package customlicense
22

33
const exampleCommand = `
44
# Convert XML file to JSON and YAML with the file path provided in the command line

cmd/subcommand/customLicense/customLicense.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
package customLicense
1+
package customlicense
22

3-
import (
3+
import (
44
"io"
55
"net/http"
66
"os"

cmd/subcommand/xmlconvert/xmlconvert.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,17 @@ func (xml *XMLConvertCmd) run(cmd *cobra.Command, args []string) {
6767
// Check if only one output file is provided
6868
if len(outputFiles) == 1 {
6969
fileExtension := strings.Split(outputFiles[0], ".")[len(strings.Split(outputFiles[0], "."))-1]
70-
CreateFile(xmlData, outputFiles[0], fileExtension)
70+
err := CreateFile(xmlData, outputFiles[0], fileExtension)
71+
if err != nil {
72+
xml.logger.Fatal(err)
73+
}
7174
} else {
7275
for _, file := range outputFiles {
7376
fileExtension := strings.Split(file, ".")[len(strings.Split(file, "."))-1]
74-
CreateFile(xmlData, file, fileExtension)
77+
err := CreateFile(xmlData, file, fileExtension)
78+
if err != nil {
79+
xml.logger.Fatal(err)
80+
}
7581
}
7682
}
7783
}

0 commit comments

Comments
 (0)