aboutsummaryrefslogtreecommitdiffstats
path: root/main.go
diff options
context:
space:
mode:
authorKaushal Subedi2015-10-26 20:49:11 -0600
committerKaushal Subedi2015-10-26 20:49:11 -0600
commitc4a685316bb478e82cda6e8017689f4758ebfff4 (patch)
tree1476f298923bb4761908d2d239b32235eb139dad /main.go
parentf5f1e23dba10c1a2dc3d90afb2c8d0dec70b2ebc (diff)
downloadgomove-c4a685316bb478e82cda6e8017689f4758ebfff4.tar.bz2
changed the way imports are replaced on AST
Diffstat (limited to 'main.go')
-rw-r--r--main.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/main.go b/main.go
index c757961..cc1c227 100644
--- a/main.go
+++ b/main.go
@@ -155,7 +155,7 @@ func ProcessFileAST(filePath string, from string, to string) {
for _, mPackage := range imports {
for _, mImport := range mPackage {
// Since astutil returns the path string with quotes, remove those
- importString := strings.Replace(mImport.Path.Value, "\"", "", -1)
+ importString := mImport.Path.Value
// If the path matches the oldpath, replace it with the new one
if strings.Contains(importString, from) {
@@ -163,7 +163,7 @@ func ProcessFileAST(filePath string, from string, to string) {
numChanges++
// Join the path of the import package with the remainder from the old one after removing the old import package
- replacePackage := path.Join(to, strings.Replace(importString, from, "", -1))
+ replacePackage := strings.Replace(importString, from, to, -1)
fmt.Println(red + "Updating import " + importString + " from file " + reset + white + filePath + reset + red + " to " + reset + white + replacePackage + reset)