func (c *Checker) CheckUnexportedReturn(j *lint.Job) {
	for _, fn := range j.Program.InitialFunctions {
		if fn.Synthetic != "" || fn.Parent() != nil {
			continue
		}
		if !ast.IsExported(fn.Name()) || IsInMain(j, fn) || IsInTest(j, fn) {
			continue
		}
		sig := fn.Type().(*types.Signature)
		if sig.Recv() != nil && !ast.IsExported(Dereference(sig.Recv().Type()).(*types.Named).Obj().Name()) {
			continue
		}
		res := sig.Results()
		for i := 0; i < res.Len(); i++ {
			if named, ok := DereferenceR(res.At(i).Type()).(*types.Named); ok &&
				!ast.IsExported(named.Obj().Name()) &&
				named != types.Universe.Lookup("error").Type() {
				j.Errorf(fn, "should not return unexported type")
			}
		}
	}
}
func (c *Checker) CheckUnexportedReturn(j *lint.Job) {
	for _, fn := range j.Program.InitialFunctions {
		if fn.Synthetic != "" || fn.Parent() != nil {
			continue
		}
		if !ast.IsExported(fn.Name()) || IsInMain(j, fn) || IsInTest(j, fn) {
			continue
		}
		sig := fn.Type().(*types.Signature)
		if sig.Recv() != nil && !ast.IsExported(Dereference(sig.Recv().Type()).(*types.Named).Obj().Name()) {
			continue
		}
		res := sig.Results()
		for i := 0; i < res.Len(); i++ {
			if named, ok := DereferenceR(res.At(i).Type()).(*types.Named); ok &&
				!ast.IsExported(named.Obj().Name()) &&
				named != types.Universe.Lookup("error").Type() {
				j.Errorf(fn, "should not return unexported type")
			}
		}
	}
}
func ( c * Checker ) CheckUnexportedReturn ( j * lint . Job ) { for _ , fn := range j . Program . InitialFunctions { if fn . Synthetic != " " || fn . Parent ( ) != nil { continue } if ! ast . IsExported ( fn . Name ( ) ) || IsInMain ( j , fn ) || IsInTest ( j , fn ) { continue } sig := fn . Type ( ) . ( * types . Signature ) if sig . Recv ( ) != nil && ! ast . IsExported ( Dereference ( sig . Recv ( ) . Type ( ) ) . ( * types . Named ) . Obj ( ) . Name ( ) ) { continue } res := sig . Results ( ) for i := 0 ; i < res . Len ( ) ; i ++ { if named , ok := DereferenceR ( res . At ( i ) . Type ( ) ) . ( * types . Named ) ; ok && ! ast . IsExported ( named . Obj ( ) . Name ( ) ) && named != types . Universe . Lookup ( " " ) . Type ( ) { j . Errorf ( fn , " " ) } } } }
// CheckUnexportedReturn checks that exported functions on exported
// types do not return unexported types.
CheckUnexportedReturn checks that exported functions on exported types do not return unexported types .