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
Assignees
Labels
Milestone

Comments

@pbberlin
Copy link

@pbberlin 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
Contributor

@crawshaw crawshaw commented Oct 31, 2016

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

@pbberlin pbberlin commented Oct 31, 2016

@mvdan mvdan added the OS-Windows label Jan 9, 2018
@gopherbot gopherbot added the Tools label Sep 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants
You can’t perform that action at this time.