Skip to content

Commit

Permalink
fix: linting issues
Browse files Browse the repository at this point in the history
* remove unnecessary break statement
* remove explicit make(map[string]string, 0)
* remove unnecessary fmt.Sprintf
  • Loading branch information
shibumi authored and ashcrow committed Feb 3, 2022
1 parent 77b4cfe commit 5215700
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packageurl.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func QualifiersFromMap(mm map[string]string) Qualifiers {

// Map converts a Qualifiers struct to a string map.
func (qq Qualifiers) Map() map[string]string {
m := make(map[string]string, 0)
m := make(map[string]string)

for i := 0; i < len(qq); i++ {
k := qq[i].Key
Expand Down
5 changes: 2 additions & 3 deletions packageurl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (m *OrderedMap) UnmarshalJSON(bytes []byte) error {
switch data {
case "null":
m.OrderedKeys = []string{}
m.Map = make(map[string]string, 0)
m.Map = make(map[string]string)
return nil
default:
// ensure that the data is a json object "{...}"
Expand All @@ -90,7 +90,6 @@ func (m *OrderedMap) UnmarshalJSON(bytes []byte) error {
return fmt.Errorf("qualifiers parse error: expected delimiter '}', got: %v", token)
}
// closed json object -> we're done
break
case string:
// this token is a dictionary key
m.OrderedKeys = append(m.OrderedKeys, token)
Expand Down Expand Up @@ -250,7 +249,7 @@ func TestStringer(t *testing.T) {
}

// Verify that the %s format modifier works for values.
fmtStr := fmt.Sprintf("%s", purlValue)
fmtStr := purlValue.String()
if fmtStr != purlPtr.String() {
t.Logf("%s failed: %%s format modifier does not work on values: %s != %s", tc.Description, fmtStr, purlPtr.ToString())
t.Fail()
Expand Down

0 comments on commit 5215700

Please sign in to comment.