// findSumTypeDefs attempts to find a Go type definition for each of the given
// sum type declarations. If no such sum type definition could be found for
// any of the given declarations, then an error is returned.
findSumTypeDefs attempts to find a Go type definition for each of the given
sum type declarations. If no such sum type definition could be found for
any of the given declarations, then an error is returned.
// findSumTypeDefs attempts to find a Go type definition for each of the given // sum type declarations . If no such sum type definition could be found for // any of the given declarations then an error is returned .
func findSumTypeDefs(decls []sumTypeDecl) ([]sumTypeDef, []error) {
	var defs []sumTypeDef
	var errs []error
	for _, decl := range decls {
		def, err := newSumTypeDef(decl.Package.Types, decl)
		if err != nil {
			errs = append(errs, err)
			continue
		}
		if def == nil {
			errs = append(errs, notFoundError{decl})
			continue
		}
		defs = append(defs, *def)
	}
	return defs, errs
}
func findSumTypeDefs ( decls [ ] sumTypeDecl ) ( [ ] sumTypeDef , [ ] error ) { var defs [ ] sumTypeDef var errs [ ] error for _ , decl := range decls { def , err := newSumTypeDef ( decl . Package . Types , decl ) if err != nil { errs = append ( errs , err ) continue } if def == nil { errs = append ( errs , notFoundError { decl } ) continue } defs = append ( defs , * def ) } return defs , errs }
findSumTypeDefs attempts to find a Go type definition for each of the given
sum type declarations.
findSumTypeDefs attempts to find a Go type definition for each of the given sum type declarations .