Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/tools/refactor/rename: doesn't work on Windows #17687

Open
pbberlin opened this issue Oct 31, 2016 · 2 comments
Open

x/tools/refactor/rename: doesn't work on Windows #17687

pbberlin opened this issue Oct 31, 2016 · 2 comments
Labels
OS-Windows Refactoring Issues related to refactoring tools Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@pbberlin
Copy link

pbberlin commented Oct 31, 2016

Go 1.7
Windows 64 Bit

I hope, I fixed the problem with go move package under windows.

bradfitz outcommented the tests for windows.
Now they work.

There was a tiny replace oversight -
from [unix] package path to [windows] file path.

https://play.golang.org/p/76oMBOgedE

Here is the patch

diff --git a/refactor/rename/mvpkg.go b/refactor/rename/mvpkg.go
index cd416c5..eed338a 100644
--- a/refactor/rename/mvpkg.go
+++ b/refactor/rename/mvpkg.go
@@ -80,7 +80,8 @@ func Move(ctxt *build.Context, from, to, moveTmpl string) error {
 			affectedPackages[r] = true
 		}
 		// Ensure directories have a trailing separator.
-		dest := strings.Replace(pkg,
+		dest := strings.Replace(
+			filepath.Join(pkg, ""),
 			filepath.Join(from, ""),
 			filepath.Join(to, ""),
 			1)
diff --git a/refactor/rename/mvpkg_test.go b/refactor/rename/mvpkg_test.go
index 674fe6c..ba2536a 100644
--- a/refactor/rename/mvpkg_test.go
+++ b/refactor/rename/mvpkg_test.go
@@ -12,7 +12,6 @@ import (
 	"path/filepath"
 	"reflect"
 	"regexp"
-	"runtime"
 	"strings"
 	"testing"
 
@@ -114,9 +113,9 @@ var _ foo.T
 }
 
 func TestMoves(t *testing.T) {
-	if runtime.GOOS == "windows" {
-		t.Skip("broken on Windows; see golang.org/issue/16384")
-	}
+	// if runtime.GOOS == "windows" {
+	// 	t.Skip("broken on Windows; see golang.org/issue/16384")
+	// }
 	tests := []struct {
 		ctxt         *build.Context
 		from, to     string
@crawshaw
Copy link
Member

Hello. Go uses gerrit for patches. Please see https://golang.org/doc/contribute.html for details.

@bradfitz bradfitz added this to the Unreleased milestone Oct 31, 2016
@bradfitz bradfitz changed the title Fix for golang.org/issue/16384 x/tools/refactor/rename: doesn't work on Windows Oct 31, 2016
@pbberlin
Copy link
Author

Submitted patch to Gerrit:
https://go-review.googlesource.com/#/c/32392/

@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Sep 12, 2019
@adonovan adonovan added the Refactoring Issues related to refactoring tools label Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OS-Windows Refactoring Issues related to refactoring tools Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

7 participants