@@ -315,8 +315,6 @@ func getConfigFileFlagDefault() string {
315315func newRootCmd (out , errOut io.Writer , args []string ) (* cobra.Command , error ) {
316316 global = new (GlobalOpts )
317317
318- var updateNoticeCh = make (chan string , 1 ) // buffered — goroutine never blocks
319-
320318 cmd := & cobra.Command {
321319 Use : "kosli" ,
322320 Short : "The Kosli CLI." ,
@@ -332,24 +330,6 @@ func newRootCmd(out, errOut io.Writer, args []string) (*cobra.Command, error) {
332330 return err
333331 }
334332
335- // Fire update check in background — result collected in PostRun.
336- // Skip when:
337- // - "version" subcommand: runs the check synchronously itself
338- // - "__complete*": Cobra shell-completion commands fire on every Tab press
339- // - debug mode: noisy HTTP traffic is undesirable when debugging
340- // Note: --version is handled by Cobra before any hooks run, so it never
341- // reaches this point; innerMain handles the notice for that case.
342- if cmd .Name () != "version" && ! strings .HasPrefix (cmd .Name (), "__" ) && ! global .Debug {
343- f := cmd .Flags ().Lookup ("output" )
344- // skip version checks for programmatic output (avoid polluting JSON in CI pipelines)
345- if f == nil || f .Value .String () == "table" {
346- go func () {
347- notice , _ := version .CheckForUpdate (version .GetVersion ())
348- updateNoticeCh <- notice
349- }()
350- }
351- }
352-
353333 if global .ApiToken == "DRY_RUN" {
354334 global .DryRun = true
355335 }
@@ -372,16 +352,6 @@ func newRootCmd(out, errOut io.Writer, args []string) (*cobra.Command, error) {
372352
373353 return flagError
374354 },
375- PersistentPostRun : func (cmd * cobra.Command , args []string ) {
376- select {
377- case notice := <- updateNoticeCh :
378- if notice != "" {
379- _ , _ = fmt .Fprint (errOut , notice ) // stderr — doesn't pollute piped stdout
380- }
381- default :
382- // goroutine not done yet (took > command duration) — skip silently
383- }
384- },
385355 }
386356 cmd .SetVersionTemplate ("{{.Version}}\n " )
387357 cmd .PersistentFlags ().StringVarP (& global .ApiToken , "api-token" , "a" , "" , apiTokenFlag )
0 commit comments