in tools/go-agent/tools/dst.go [106:129]
func RemovePackageRef(parent dst.Node, current *dst.SelectorExpr, inx int) {
switch p := parent.(type) {
case *dst.Field:
p.Type = dst.NewIdent(current.Sel.Name)
case *dst.Ellipsis:
p.Elt = dst.NewIdent(current.Sel.Name)
case *dst.StarExpr:
p.X = dst.NewIdent(current.Sel.Name)
case *dst.TypeAssertExpr:
p.Type = dst.NewIdent(current.Sel.Name)
case *dst.CompositeLit:
p.Type = dst.NewIdent(current.Sel.Name)
case *dst.ArrayType:
p.Elt = dst.NewIdent(current.Sel.Name)
case *dst.CallExpr:
p.Fun = dst.NewIdent(current.Sel.Name)
case *dst.KeyValueExpr:
p.Value = dst.NewIdent(current.Sel.Name)
case *dst.AssignStmt:
p.Rhs = []dst.Expr{dst.NewIdent(current.Sel.Name)}
case *dst.CaseClause:
p.List[inx] = dst.NewIdent(current.Sel.Name)
}
}