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

gofmt not convert comment \r\n to \n #3647

Closed
gopherbot opened this issue May 21, 2012 · 3 comments
Closed

gofmt not convert comment \r\n to \n #3647

gopherbot opened this issue May 21, 2012 · 3 comments

Comments

@gopherbot
Copy link
Contributor

by VisualFC:

What steps will reproduce the problem?

1. edit windows go src and use \r\n line terminator.
//test comment,test.go

package main

func main() {
}

The file include \r\n line terminator.
//test comment,test.go[\r\n]
[\r\n]
package main[\r\n]
[\r\n]
func main() {[\r\n]
}[\r\n]

2. gofmt -w test.go

3. the output test.go comment include [\r\n]

What is the expected output?
//test comment,test.go[\r\n]

package main[\n]
...

What do you see instead?
//test comment,test.go[\n]
package main[\n]
...


Which operating system are you using?
Windows7

Which version are you using?  (run 'go version')
go1.01

Please provide any additional information below.
The gofmt not convert source comment \r\n to \n
@rsc
Copy link
Contributor

rsc commented May 21, 2012

Comment 1:

I can confirm this behavior: I created a file with \r at end of lines:
package p\r
\r
// hello world\r
and when you run through gofmt you get
package p
// hello world\r
The \r stripping should probably apply during comments too.

Owner changed to @griesemer.

Status changed to Accepted.

@griesemer
Copy link
Contributor

Comment 2:

http://golang.org/cl/6225047

@griesemer
Copy link
Contributor

Comment 3:

This issue was closed by revision 7b9a6d8.

Status changed to Fixed.

@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants