func (f *useFinder) visitSelector(sel *ast.SelectorExpr) ast.Visitor {
	debugf("pos(sel): %v", f.position(sel.Pos()))
	debugf("sel.X: %v", sel.X)
	debugf("sel.Sel: %v", sel.Sel)

	rcvrIdent, ok := sel.X.(*ast.Ident)
	if !ok {
		debugf("nil rcvrIdent, type=%T", sel.X)
		return nil
	}

	rcvrObj := f.typeInfo.ObjectOf(rcvrIdent)
	switch rcvr := rcvrObj.(type) {
	case *types.PkgName:
		// The receiver is a package. Is it the package we're querying for?
		if rcvr.Imported() == f.target.pkg {
			// Yes! Check if the selection is one of the objects we're hunting for.
			selObj := f.typeInfo.ObjectOf(sel.Sel)
			discovered := f.target.discover(selObj)
			debugf("discovered: %v", discovered)
			return f
		} else {
			debugf("wrong pkg")
			return nil
		}
	case *types.Var:
		debugf("rcvrObj is a var")
		// The receiver is a var. Is it one of the objects we're looking for?
		found := f.target.discover(rcvrObj)
		if !found {

		}
	default:
		debugf("unexpected rcvrObj.(type): %T", rcvrObj)
	}

	// Now time to look at the selected value.
	selObj := f.typeInfo.ObjectOf(sel.Sel)
	debugf("sel obj=%v", selObj)
	f.target.discover(selObj)

	return nil
}
// visitSelector visits a selector expression. This is one of the main chances
// we have to identify uses of the query targets.
visitSelector visits a selector expression. This is one of the main chances
we have to identify uses of the query targets.
// visitSelector visits a selector expression . This is one of the main chances // we have to identify uses of the query targets .
func (f *useFinder) visitSelector(sel *ast.SelectorExpr) ast.Visitor {
	debugf("pos(sel): %v", f.position(sel.Pos()))
	debugf("sel.X: %v", sel.X)
	debugf("sel.Sel: %v", sel.Sel)
	rcvrIdent, ok := sel.X.(*ast.Ident)
	if !ok {
		debugf("nil rcvrIdent, type=%T", sel.X)
		return nil
	}
	rcvrObj := f.typeInfo.ObjectOf(rcvrIdent)
	switch rcvr := rcvrObj.(type) {
	case *types.PkgName:
		if rcvr.Imported() == f.target.pkg {
			selObj := f.typeInfo.ObjectOf(sel.Sel)
			discovered := f.target.discover(selObj)
			debugf("discovered: %v", discovered)
			return f
		} else {
			debugf("wrong pkg")
			return nil
		}
	case *types.Var:
		debugf("rcvrObj is a var")
		found := f.target.discover(rcvrObj)
		if !found {
		}
	default:
		debugf("unexpected rcvrObj.(type): %T", rcvrObj)
	}
	selObj := f.typeInfo.ObjectOf(sel.Sel)
	debugf("sel obj=%v", selObj)
	f.target.discover(selObj)
	return nil
}
func ( f * useFinder ) visitSelector ( sel * ast . SelectorExpr ) ast . Visitor { debugf ( " " , f . position ( sel . Pos ( ) ) ) debugf ( " " , sel . X ) debugf ( " " , sel . Sel ) rcvrIdent , ok := sel . X . ( * ast . Ident ) if ! ok { debugf ( " " , sel . X ) return nil } rcvrObj := f . typeInfo . ObjectOf ( rcvrIdent ) switch rcvr := rcvrObj . ( type ) { case * types . PkgName : if rcvr . Imported ( ) == f . target . pkg { selObj := f . typeInfo . ObjectOf ( sel . Sel ) discovered := f . target . discover ( selObj ) debugf ( " " , discovered ) return f } else { debugf ( " " ) return nil } case * types . Var : debugf ( " " ) found := f . target . discover ( rcvrObj ) if ! found { } default : debugf ( " " , rcvrObj ) } selObj := f . typeInfo . ObjectOf ( sel . Sel ) debugf ( " " , selObj ) f . target . discover ( selObj ) return nil }
visitSelector visits a selector expression.
visitSelector visits a selector expression .
// The receiver is a package. Is it the package we're querying for? // Yes! Check if the selection is one of the objects we're hunting for. // The receiver is a var. Is it one of the objects we're looking for? // Now time to look at the selected value.