MCPcopy Index your code
hub / github.com/jetify-com/devbox / CheckVersion

Function CheckVersion

internal/vercheck/vercheck.go:59–95  ·  view source on GitHub ↗

CheckVersion checks the launcher and binary versions and prints a notice if they are out of date. It will set the checkVersionEnvName to indicate that the version check was done. Callers should call ClearEnvVar after their work is done.

(w io.Writer, commandPath string)

Source from the content-addressed store, hash-verified

57// It will set the checkVersionEnvName to indicate that the version check was done.
58// Callers should call ClearEnvVar after their work is done.
59func CheckVersion(w io.Writer, commandPath string) {
60 if isDevBuild {
61 return
62 }
63
64 if os.Getenv(envName) == "1" {
65 return
66 }
67
68 if envir.IsDevboxCloud() {
69 return
70 }
71
72 hasSkipPrefix := lo.ContainsBy(
73 commandSkipList,
74 func(skipPath string) bool { return strings.HasPrefix(commandPath, skipPath) },
75 )
76 if hasSkipPrefix {
77 return
78 }
79
80 // check launcher version
81 launcherNotice := launcherVersionNotice()
82 if launcherNotice != "" {
83 ux.Finfo(w, launcherNotice)
84
85 // fallthrough to alert the user about a new Devbox CLI binary being possibly available
86 }
87
88 // check devbox CLI version
89 devboxNotice := devboxVersionNotice()
90 if devboxNotice != "" {
91 ux.Finfo(w, devboxNotice)
92 }
93
94 os.Setenv(envName, "1")
95}
96
97// SelfUpdate updates the devbox launcher and devbox CLI binary.
98// It ignores and deletes the version cache.

Callers 2

RootCmdFunction · 0.92
TestCheckVersionFunction · 0.85

Calls 4

IsDevboxCloudFunction · 0.92
FinfoFunction · 0.92
launcherVersionNoticeFunction · 0.85
devboxVersionNoticeFunction · 0.85

Tested by 1

TestCheckVersionFunction · 0.68