func (b *Builder) Build() error {
	var err error

	if b.Name == "" {
		pwd, err := os.Getwd()
		if err != nil {
			return fmt.Errorf("builder: could not fetch current work directory: %w", err)
		}
		b.Name = filepath.Base(pwd)
	}

	err = b.doTypeCheck()
	if err != nil {
		return err
	}

	// check we build a 'main' package
	if !b.isMain() {
		return fmt.Errorf("not a 'main' package")
	}

	err = b.scanSetupFuncs()
	if err != nil {
		return err
	}

	if len(b.funcs) <= 0 {
		return fmt.Errorf("no setup function found")
	}

	err = b.genSources()
	if err != nil {
		return err
	}

	return err
}
// Build applies some type-checking, collects setup functions and generates the sources of the fwk-based application.
Build applies some type-checking, collects setup functions and generates the sources of the fwk-based application.
// Build applies some type - checking collects setup functions and generates the sources of the fwk - based application .
func (b *Builder) Build() error {
	var err error
	if b.Name == "" {
		pwd, err := os.Getwd()
		if err != nil {
			return fmt.Errorf("builder: could not fetch current work directory: %w", err)
		}
		b.Name = filepath.Base(pwd)
	}
	err = b.doTypeCheck()
	if err != nil {
		return err
	}
	if !b.isMain() {
		return fmt.Errorf("not a 'main' package")
	}
	err = b.scanSetupFuncs()
	if err != nil {
		return err
	}
	if len(b.funcs) <= 0 {
		return fmt.Errorf("no setup function found")
	}
	err = b.genSources()
	if err != nil {
		return err
	}
	return err
}
func ( b * Builder ) Build ( ) error { var err error if b . Name == " " { pwd , err := os . Getwd ( ) if err != nil { return fmt . Errorf ( " " , err ) } b . Name = filepath . Base ( pwd ) } err = b . doTypeCheck ( ) if err != nil { return err } if ! b . isMain ( ) { return fmt . Errorf ( " " ) } err = b . scanSetupFuncs ( ) if err != nil { return err } if len ( b . funcs ) <= 0 { return fmt . Errorf ( " " ) } err = b . genSources ( ) if err != nil { return err } return err }
Build applies some type-checking, collects setup functions and generates the sources of the fwk-based application.
Build applies some type - checking collects setup functions and generates the sources of the fwk - based application .
// check we build a 'main' package