8000 os: output CR LF for \n on Windows · Issue #28822 · golang/go · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
os: output CR LF for \n on Windows #28822
Closed
@jftuga

Description

@jftuga

What version of Go are you using (go version)?

$ go version
go version go1.11.1 windows/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\john\AppData\Local\go-build
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Users\john\go
set GOPROXY=
set GORACE=
set GOROOT=C:\Go
set GOTMPDIR=
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\john\AppData\Local\Temp\go-build222202374=/tmp/go-build -gno-record-gcc-switches

What did you do?

package main
import "fmt"
func main() {
   fmt.Println("test")
}

What did you expect to see?

C:\>test.exe | od -tx1
0000000 74 65 73 74 0d 0a
(notice the Carriage-Return character = 0x0d)

According to https://en.wikipedia.org/wiki/Newline#Representation

A newline under Windows is represented by CR LF, which is 0x0d 0x0a

Please consider adding 0x0d to fmt.Println, Printf, etc.

What did you see instead?

C:\>test.exe | od -tx1
0000000 74 65 73 74 0a
(Carriage Return is missing, but Linefeed is there
< 495C div class="IssueViewer-module__issueViewerMetadataPane--Q1n1b" data-testid="issue-viewer-metadata-pane">

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.OS-Windows

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0