Skip to content

Commit

Permalink
remove duplicate code
Browse files Browse the repository at this point in the history
  • Loading branch information
jreisinger committed Jun 7, 2024
1 parent 25193ea commit c989f2f
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions checkip.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package checkip

import (
"encoding/json"
"fmt"
"net"
)

Expand All @@ -18,19 +19,11 @@ type Type int

// String returns the name of the Check type.
func (t Type) String() string {
return [...]string{"Info", "Sec", "InfoSec"}[t]
return [...]string{"info", "sec", "infosec"}[t]
}

func (t Type) MarshalJSON() ([]byte, error) {
var s string
switch t {
case TypeInfo:
s = "info"
case TypeSec:
s = "security"
case TypeInfoSec:
s = "infoAndSecurity"
}
s := fmt.Sprint(t)
return json.Marshal(s)
}

Expand Down

0 comments on commit c989f2f

Please sign in to comment.