Skip to content

Commit

Permalink
Code refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
andyone committed Dec 17, 2024
1 parent 04b509e commit d5fab36
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
2 changes: 1 addition & 1 deletion beans.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type jmxBeans struct {

// ParseBeans parses beans data
func ParseBeans(data string) ([]*Bean, error) {
data = strings.Replace(data, `\"`, `"`, -1)
data = strings.ReplaceAll(data, `\"`, `"`)

beans := &jmxBeans{}
err := json.Unmarshal([]byte(data), beans)
Expand Down
12 changes: 3 additions & 9 deletions cmd/zabbix-jmx-get/zabbix-jmx-get.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,12 +241,6 @@ func makeRequest(serverHost string, serverPort int, keys []string) *jmx.Request
return r
}

// printErrorAndExit print error message and exit with exit code 1
func printErrorAndExit(f string, a ...interface{}) {
terminal.Error(f, a...)
os.Exit(1)
}

// ////////////////////////////////////////////////////////////////////////////////// //

// printCompletion prints completion for given shell
Expand All @@ -255,11 +249,11 @@ func printCompletion() int {

switch options.GetS(OPT_COMPLETION) {
case "bash":
fmt.Printf(bash.Generate(info, APP))
fmt.Print(bash.Generate(info, APP))
case "fish":
fmt.Printf(fish.Generate(info, APP))
fmt.Print(fish.Generate(info, APP))
case "zsh":
fmt.Printf(zsh.Generate(info, optMap, APP))
fmt.Print(zsh.Generate(info, optMap, APP))
default:
return 1
}
Expand Down

0 comments on commit d5fab36

Please sign in to comment.