diff options
| author | Kaushal Subedi | 2015-10-26 21:30:57 -0600 | 
|---|---|---|
| committer | Kaushal Subedi | 2015-10-26 21:30:57 -0600 | 
| commit | b054b1484339660a0923322a2fc8f2ecfd8733ab (patch) | |
| tree | 522624a289ebcb19fe16ba268140966a2069c1a1 /native.go | |
| parent | f9f290984c33b651b3d5c3f5e5b6b13adaf8cdc8 (diff) | |
| download | gomove-b054b1484339660a0923322a2fc8f2ecfd8733ab.tar.bz2 | |
added checks to make sure non changed files do not get written
Diffstat (limited to 'native.go')
| -rw-r--r-- | native.go | 48 | 
1 files changed, 27 insertions, 21 deletions
| @@ -52,17 +52,20 @@ func ProcessFileNative(filePath string, from string, to string) {  			newImport := strings.Replace(line, from, to, -1)  			output += newImport + "\n" -			numChages++ - -			fmt.Println(red+"Updating "+ -				reset+white+ -				line+ -				reset+red+ -				" to "+ -				reset+white+ -				newImport+ -				reset+red+ -				"on line", scanLine, reset) +			if line != newImport { +				numChages++ + +				fmt.Println(red+"Updating "+ +					reset+white+ +					line+ +					reset+red+ +					" to "+ +					reset+white+ +					newImport+ +					reset+red+ +					"on line", scanLine, reset) +			} +  			continue  		} @@ -79,16 +82,19 @@ func ProcessFileNative(filePath string, from string, to string) {  		if isImportLine {  			newImport := strings.Replace(line, from, to, -1)  			output += newImport + "\n" -			numChages++ -			fmt.Println(red+"Updating import "+ -				reset+white+ -				line+ -				reset+red+ -				"to"+ -				reset+white+ -				newImport+ -				reset+red+ -				"on line", scanLine, reset) +			if line != newImport { +				numChages++ +				fmt.Println(red+"Updating text "+ +					reset+white+ +					line+ +					reset+red+ +					" to "+ +					reset+white+ +					newImport+ +					reset+red+ +					" on line", scanLine, reset) + +			}  			continue  		} | 
