Skip to content

testing: output failure report to stderr as per docu instead of stdout #16138

@tpepper

Description

@tpepper

Please answer these questions before submitting your issue. Thanks!

  1. What version of Go are you using (go version)?
    1.6.2
    (installed via go1.6.2.linux-amd64.tar.gz at https://golang.org/dl/)
  2. What operating system and processor architecture are you using (go env)?
    The OS is Fedora 23 (Workstation Edition). The go env output doesn't quite capture that fully:

GOARCH="amd64"
GOBIN="/usr/src/go/bin"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/usr/src/go"
GORACE=""
GOROOT="/usr/src/golang-1.6"
GOTOOLDIR="/usr/src/golang-1.6/pkg/tool/linux_amd64"
GO15VENDOREXPERIMENT="1"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"

  1. What did you do?
    go code https://play.golang.org/p/6GR6cTzVcM
    go test case for that code https://play.golang.org/p/ZEJ2iNJMPV

Run a simple test case that fails, outputting a t.Fatal(err).

  1. What did you expect to see?

https://golang.org/pkg/testing/#T indicates that testing logs are accumulated and output to stderr so I expect the t.Fatal() output report to be on stderr.

  1. What did you see instead?

The report output is on stdout.

It seems like something as trivial as tpepper@c60fccd (which is on top of tip's changes to allow subtests) could bring the report output in line with the documentation. But as noted in that tentative commit message, this might break users who have coded to the behavior without reporting the inconsistency. Perhaps the answer is to change the documentation, except the enabling the distinction between stdout and stderr is actually useful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions