Skip to content

Commit

Permalink
appease linter
Browse files Browse the repository at this point in the history
  • Loading branch information
alessio-perugini committed Oct 10, 2023
1 parent 4f7fc98 commit 5ef97a8
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions internal/cli/arguments/reference.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,30 +67,30 @@ func ParseReference(arg string) (*Reference, error) {
return nil, fmt.Errorf(tr("invalid empty core argument"))
}

if toks := strings.SplitN(arg, "@", 2); toks[0] == "" {
toks := strings.SplitN(arg, "@", 2)
if toks[0] == "" {
return nil, fmt.Errorf(tr("invalid empty core reference '%s'"), arg)
} else {
ret.PackageName = toks[0]
if len(toks) > 1 {
if toks[1] == "" {
return nil, fmt.Errorf(tr("invalid empty core version: '%s'"), arg)
}
ret.Version = toks[1]
}
ret.PackageName = toks[0]
if len(toks) > 1 {
if toks[1] == "" {
return nil, fmt.Errorf(tr("invalid empty core version: '%s'"), arg)
}
ret.Version = toks[1]
}

if toks := strings.Split(ret.PackageName, ":"); len(toks) != 2 {
toks = strings.Split(ret.PackageName, ":")
if len(toks) != 2 {
return nil, fmt.Errorf(tr("invalid item %s"), arg)
} else {
if toks[0] == "" {
return nil, fmt.Errorf(tr("invalid empty core name '%s'"), arg)
}
ret.PackageName = toks[0]
if toks[1] == "" {
return nil, fmt.Errorf(tr("invalid empty core architecture '%s'"), arg)
}
ret.Architecture = toks[1]
}
if toks[0] == "" {
return nil, fmt.Errorf(tr("invalid empty core name '%s'"), arg)
}
if toks[1] == "" {
return nil, fmt.Errorf(tr("invalid empty core architecture '%s'"), arg)
}
ret.PackageName = toks[0]
ret.Architecture = toks[1]

// Now that we have the required informations in `ret` we can
// try to use core.PlatformList to optimize what the user typed
Expand Down Expand Up @@ -126,7 +126,7 @@ func ParseReference(arg string) (*Reference, error) {
if len(foundPlatforms) > 1 {
return nil, &arduino.MultiplePlatformsError{Platforms: foundPlatforms, UserPlatform: arg}
}
toks := strings.Split(foundPlatforms[0], ":")
toks = strings.Split(foundPlatforms[0], ":")
ret.PackageName = toks[0]
ret.Architecture = toks[1]
return ret, nil
Expand Down

0 comments on commit 5ef97a8

Please sign in to comment.