Skip to content

Commit

Permalink
fix: empty slice declaration using literal
Browse files Browse the repository at this point in the history
  • Loading branch information
shibumi authored and ashcrow committed Feb 3, 2022
1 parent 5215700 commit 7711a9e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions packageurl.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ type Qualifier struct {
}

func (q Qualifier) String() string {
// A value must be must be a percent-encoded string
// A value must be a percent-encoded string
return fmt.Sprintf("%s=%s", q.Key, url.PathEscape(q.Value))
}

Expand Down Expand Up @@ -156,7 +156,7 @@ func (p *PackageURL) ToString() string {
purl := fmt.Sprintf("pkg:%s/", p.Type)
// Add namespaces if provided
if p.Namespace != "" {
ns := []string{}
var ns []string
for _, item := range strings.Split(p.Namespace, "/") {
ns = append(ns, url.QueryEscape(item))
}
Expand Down Expand Up @@ -276,7 +276,7 @@ func FromString(purl string) (PackageURL, error) {
version = v
name = name[:atIndex]
}
namespaces := []string{}
var namespaces []string

if index != -1 {
remainder = remainder[:index]
Expand Down
4 changes: 2 additions & 2 deletions packageurl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ func TestToStringExamples(t *testing.T) {
t.Fatal(err)
}
// Load the json file contents into a structure
testData := []TestFixture{}
var testData []TestFixture
err = json.Unmarshal(data, &testData)
if err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -225,7 +225,7 @@ func TestStringer(t *testing.T) {
t.Fatal(err)
}
// Load the json file contents into a structure
testData := []TestFixture{}
var testData []TestFixture
err = json.Unmarshal(data, &testData)
if err != nil {
t.Fatal(err)
Expand Down

0 comments on commit 7711a9e

Please sign in to comment.