From b02c0fa2fca5512ac3a8174e9e14f0a079c632c3 Mon Sep 17 00:00:00 2001
From: Grant Murphy <grantcmurphy@gmail.com>
Date: Sun, 6 Nov 2016 12:15:32 -0800
Subject: [PATCH] Add imports dumper

---
 tools.go | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/tools.go b/tools.go
index 0151328..9bf03f3 100644
--- a/tools.go
+++ b/tools.go
@@ -40,6 +40,7 @@ func newUtils() *utilities {
 	utils["types"] = dumpTypes
 	utils["defs"] = dumpDefs
 	utils["comments"] = dumpComments
+	utils["imports"] = dumpImports
 	return &utilities{utils, make([]string, 0)}
 }
 
@@ -218,3 +219,18 @@ func dumpComments(files ...string) {
 		}
 	}
 }
+
+func dumpImports(files ...string) {
+	for _, file := range files {
+		if shouldSkip(file) {
+			continue
+		}
+		context := createContext(file)
+		for _, pkg := range context.pkg.Imports() {
+			fmt.Println(pkg.Path(), pkg.Name())
+			for _, name := range pkg.Scope().Names() {
+				fmt.Println("  => ", name)
+			}
+		}
+	}
+}