func (prog *Program) Build() {
	var wg sync.WaitGroup
	for _, p := range prog.packages {
		if prog.mode&BuildSerially != 0 {
			p.Build()
		} else {
			wg.Add(1)
			go func(p *Package) {
				p.Build()
				wg.Done()
			}(p)
		}
	}
	wg.Wait()
}
func (prog *Program) Build() {
	var wg sync.WaitGroup
	for _, p := range prog.packages {
		if prog.mode&BuildSerially != 0 {
			p.Build()
		} else {
			wg.Add(1)
			go func(p *Package) {
				p.Build()
				wg.Done()
			}(p)
		}
	}
	wg.Wait()
}
func ( prog * Program ) Build ( ) { var wg sync . WaitGroup for _ , p := range prog . packages { if prog . mode & BuildSerially != 0 { p . Build ( ) } else { wg . Add ( 1 ) go func ( p * Package ) { p . Build ( ) wg . Done ( ) } ( p ) } } wg . Wait ( ) }
// Build calls Package.Build for each package in prog.
// Building occurs in parallel unless the BuildSerially mode flag was set.
//
// Build is intended for whole-program analysis; a typical compiler
// need only build a single package.
//
// Build is idempotent and thread-safe.
//
Build calls Package . Build for each package in prog . Building occurs in parallel unless the BuildSerially mode flag was set . Build is intended for whole - program analysis ; a typical compiler need only build a single package . Build is idempotent and thread - safe .