Skip to content

Commit 5bd8007

Browse files
committed
refactor(cli): optimize core sdk version resolution with switch statement
1 parent 4c0fc92 commit 5bd8007

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

.github/workflows/semver-enforcer.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,4 +392,3 @@ jobs:
392392
\"prerelease\": false
393393
}" && echo ">>> [Compiler Oracle] Draft release created for ${NEW_TAG}" \
394394
|| echo ">>> [Compiler Oracle] Draft creation failed (non-critical)"
395-

cli/toob-cli/cmd/build.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ func checkProtocolVersion(image string) error {
310310
func runNativeBuild(root string) error {
311311
buildStartTime := time.Now()
312312
timings := &TimingTracker{}
313-
313+
314314
// Accumulate all setup overhead mathematically perfectly
315315
var setupDuration time.Duration
316316
lastSetupResume := buildStartTime
@@ -374,7 +374,7 @@ func runNativeBuild(root string) error {
374374
return fmt.Errorf("failed to sync registry: %w", err)
375375
}
376376
timings.Add("Registry Sync", time.Since(start))
377-
377+
378378
lastSetupResume = time.Now()
379379
}
380380
regDir := cache.Dir()
@@ -448,7 +448,8 @@ func runNativeBuild(root string) error {
448448
coreSDKVer := dt.Build.CoreSDK
449449
coreSDKLabel := coreSDKVer
450450

451-
if coreSDKVer == "" || coreSDKVer == "latest" {
451+
switch coreSDKVer {
452+
case "", "latest":
452453
ui.Step("Resolving latest Core SDK version...")
453454
latestTag, err := getLatestCoreSDKTag()
454455
if err == nil {
@@ -463,7 +464,7 @@ func runNativeBuild(root string) error {
463464
coreSDKLabel = "main (fallback)"
464465
}
465466
}
466-
} else if coreSDKVer == "toob-boot" {
467+
case "toob-boot":
467468
// "toob-boot" is the SDK name, not a version. Resolve to latest tag or main.
468469
latestTag, err := getLatestCoreSDKTag()
469470
if err == nil {
@@ -564,7 +565,7 @@ func runNativeBuild(root string) error {
564565
}
565566
}
566567
}
567-
568+
568569
socDir := filepath.Join(regDir, "soc")
569570
if _, err := os.Stat(socDir); err == nil {
570571
driverDirs = append(driverDirs, socDir)

0 commit comments

Comments
 (0)