Skip to content

cmd/go: cannot use 'go test' with code depending on TERM variable #12096

Closed
@ericwq

Description

@ericwq

if you run the following simple test code under 1.5rc1

func TestTermEnv(t *testing.T) {
    fmt.Printf("%s\n",os.Getenv("TERM"))
}

you will get the wrong TERM variable, while the correct result should be "xterm" prefixed.

$go test
dumb

the environment:

$ uname -a
Darwin wangs-MacBook.local 14.4.0 Darwin Kernel Version 14.4.0: Thu May 28 11:35:04 PDT 2015; root:xnu-2782.30.5~1/RELEASE_X86_64 x86_64
$ go version
go version go1.5rc1 darwin/amd64
$ env | grep TERM
TERM_PROGRAM=Apple_Terminal
TERM=xterm-256color
TERM_PROGRAM_VERSION=343.7
TERM_SESSION_ID=0033F701-265E-4DF7-B4DA-2FD9C735BD4A

i notice there is a default "dumb" value for TERM env. is this the correct default value?
the previous issue #11449 only solve the "go run" case.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions