Skip to content

Commit 0176a3b

Browse files
alessio-peruginicmaglie
authored andcommitted
appease linter
1 parent 418cee3 commit 0176a3b

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

Diff for: internal/cli/arguments/reference.go

+19-19
Original file line numberDiff line numberDiff line change
@@ -67,30 +67,30 @@ func ParseReference(arg string) (*Reference, error) {
6767
return nil, fmt.Errorf(tr("invalid empty core argument"))
6868
}
6969

70-
if toks := strings.SplitN(arg, "@", 2); toks[0] == "" {
70+
toks := strings.SplitN(arg, "@", 2)
71+
if toks[0] == "" {
7172
return nil, fmt.Errorf(tr("invalid empty core reference '%s'"), arg)
72-
} else {
73-
ret.PackageName = toks[0]
74-
if len(toks) > 1 {
75-
if toks[1] == "" {
76-
return nil, fmt.Errorf(tr("invalid empty core version: '%s'"), arg)
77-
}
78-
ret.Version = toks[1]
73+
}
74+
ret.PackageName = toks[0]
75+
if len(toks) > 1 {
76+
if toks[1] == "" {
77+
return nil, fmt.Errorf(tr("invalid empty core version: '%s'"), arg)
7978
}
79+
ret.Version = toks[1]
8080
}
8181

82-
if toks := strings.Split(ret.PackageName, ":"); len(toks) != 2 {
82+
toks = strings.Split(ret.PackageName, ":")
83+
if len(toks) != 2 {
8384
return nil, fmt.Errorf(tr("invalid item %s"), arg)
84-
} else {
85-
if toks[0] == "" {
86-
return nil, fmt.Errorf(tr("invalid empty core name '%s'"), arg)
87-
}
88-
ret.PackageName = toks[0]
89-
if toks[1] == "" {
90-
return nil, fmt.Errorf(tr("invalid empty core architecture '%s'"), arg)
91-
}
92-
ret.Architecture = toks[1]
9385
}
86+
if toks[0] == "" {
87+
return nil, fmt.Errorf(tr("invalid empty core name '%s'"), arg)
88+
}
89+
if toks[1] == "" {
90+
return nil, fmt.Errorf(tr("invalid empty core architecture '%s'"), arg)
91+
}
92+
ret.PackageName = toks[0]
93+
ret.Architecture = toks[1]
9494

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

0 commit comments

Comments
 (0)