diff options
| author | Kaushal Subedi | 2015-10-26 20:49:11 -0600 | 
|---|---|---|
| committer | Kaushal Subedi | 2015-10-26 20:49:11 -0600 | 
| commit | c4a685316bb478e82cda6e8017689f4758ebfff4 (patch) | |
| tree | 1476f298923bb4761908d2d239b32235eb139dad /main.go | |
| parent | f5f1e23dba10c1a2dc3d90afb2c8d0dec70b2ebc (diff) | |
| download | gomove-c4a685316bb478e82cda6e8017689f4758ebfff4.tar.bz2 | |
changed the way imports are replaced on AST
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 4 | 
1 files changed, 2 insertions, 2 deletions
| @@ -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) | 
