Skip to content

Commit 4cecce5

Browse files
committed
Fix lint
1 parent fbd47f9 commit 4cecce5

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

client/internal/updatemanager/manager.go

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -134,18 +134,22 @@ func (u *UpdateManager) handleUpdate(ctx context.Context) {
134134

135135
u.expectedVersionMutex.Lock()
136136
expectedVersion := u.expectedVersion
137+
useLatest := u.updateToLatestVersion
138+
curLatestVersion := u.update.LatestVersion()
137139
u.expectedVersionMutex.Unlock()
138140

141+
switch {
139142
// Resolve "latest" to actual version
140-
if u.updateToLatestVersion {
141-
if !u.isVersionAvailable() {
143+
case useLatest:
144+
if curLatestVersion == nil {
142145
log.Tracef("Latest version not fetched yet")
143146
return
144147
}
145-
updateVersion = u.update.LatestVersion()
146-
} else if u.expectedVersion != nil {
148+
updateVersion = curLatestVersion
149+
// Update to specific version
150+
case u.expectedVersion != nil:
147151
updateVersion = expectedVersion
148-
} else {
152+
default:
149153
log.Debugf("No expected version information set")
150154
return
151155
}
@@ -193,13 +197,6 @@ func (u *UpdateManager) shouldUpdate(updateVersion *v.Version) bool {
193197
return true
194198
}
195199

196-
func (u *UpdateManager) isVersionAvailable() bool {
197-
if u.update.LatestVersion() == nil {
198-
return false
199-
}
200-
return true
201-
}
202-
203200
func downloadFileToTemporaryDir(ctx context.Context, fileURL string) (string, error) { //nolint:unused
204201
tempDir, err := os.MkdirTemp("", "netbird-installer-*")
205202
if err != nil {

0 commit comments

Comments
 (0)