// FetchUpdateFiles downloads relevant files for u.Ver from u.URL
FetchUpdateFiles downloads relevant files for u.Ver from u.URL
// FetchUpdateFiles downloads relevant files for u . Ver from u . URL
func FetchUpdateFiles(u UInfo) error {
	helpers.PrintBegin("fetching files from %s at version %v", u.URL, u.Ver)
	dlFiles, err := getAllManifests(u)
	if err != nil {
		return err
	}
	var wg sync.WaitGroup
	nworkers := 8
	wg.Add(nworkers)
	fChan := make(chan finfo)
	errChan := make(chan error, nworkers)
	for i := 0; i < nworkers; i++ {
		go func() {
			defer wg.Done()
			for f := range fChan {
				if _, err := os.Lstat(strings.TrimSuffix(f.out, ".tar")); err == nil {
					continue
				}
				f.err = helpers.TarExtractURL(f.url, f.out)
				_ = os.Remove(f.out)
				if f.err != nil {
					errChan <- f.err
				}
			}
		}()
	}
	for f := range dlFiles {
		fChan <- dlFiles[f]
	}
	close(fChan)
	wg.Wait()
	if len(errChan) > 0 {
		helpers.PrintComplete("errors downloading %d files", len(errChan))
	} else {
		helpers.PrintComplete("files cached at %s", filepath.Join(u.CacheLoc, "update"))
	}
	return nil
}
func FetchUpdateFiles ( u UInfo ) error { helpers . PrintBegin ( " " , u . URL , u . Ver ) dlFiles , err := getAllManifests ( u ) if err != nil { return err } var wg sync . WaitGroup nworkers := 8 wg . Add ( nworkers ) fChan := make ( chan finfo ) errChan := make ( chan error , nworkers ) for i := 0 ; i < nworkers ; i ++ { go func ( ) { defer wg . Done ( ) for f := range fChan { if _ , err := os . Lstat ( strings . TrimSuffix ( f . out , " " ) ) ; err == nil { continue } f . err = helpers . TarExtractURL ( f . url , f . out ) _ = os . Remove ( f . out ) if f . err != nil { errChan <- f . err } } } ( ) } for f := range dlFiles { fChan <- dlFiles [ f ] } close ( fChan ) wg . Wait ( ) if len ( errChan ) > 0 { helpers . PrintComplete ( " " , len ( errChan ) ) } else { helpers . PrintComplete ( " " , filepath . Join ( u . CacheLoc , " " ) ) } return nil }
FetchUpdateFiles downloads relevant files for u.Ver from u.URL
FetchUpdateFiles downloads relevant files for u . Ver from u . URL
// we already have this file cached