func listUses(u *unexporter.Unexporter) { exports := u.NecessaryExports() w := new(tabwriter.Writer) w.Init(os.Stdout, 0, 2, 3, ' ', tabwriter.DiscardEmptyColumns|tabwriter.AlignRight) for _, e := range exports { printExport(w, e) listInterfaces(e) listOccurences(w, e) fmt.Fprintln(w, "\t") } w.Flush() }
func printObject(u *unexporter.Unexporter, o types.Object) { var objName string if simpleNamesFlag { objName = o.Name() } else { objName = o.String() } if showFilename { pos := u.PositionForObject(o) fmt.Printf("%s:%d:%d: %s\n", pos.Filename, pos.Line, pos.Column, objName) } else { fmt.Println(objName) } }
func interactiveUnexport(u *unexporter.Unexporter) { reader := bufio.NewReader(os.Stdin) exports := u.UnexportableObjects() for _, o := range exports { if u.IsNameExcluded(o.Name()) { continue } printObject(u, o) fmt.Printf("Unexport this [yN]: ") text, _ := reader.ReadString('\n') if strings.TrimSpace(text) != "y" { u.ExcludedNames = append(u.ExcludedNames, o.Name()) } } u.Unexport() }
func listObjects(u *unexporter.Unexporter) { for _, o := range u.UnexportableObjects() { printObject(u, o) } }