rakyll / gotest

go test with colors

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

go get fails in v0.0.2

kei2100 opened this issue · comments

go get fails with the following output.

# github.com/rakyll/gotest
/go/pkg/mod/github.com/rakyll/gotest@v0.0.2/main.go:105:3: undefined: c
/go/pkg/mod/github.com/rakyll/gotest@v0.0.2/main.go:113:3: undefined: c
/go/pkg/mod/github.com/rakyll/gotest@v0.0.2/main.go:117:3: undefined: c
/go/pkg/mod/github.com/rakyll/gotest@v0.0.2/main.go:123:3: undefined: c
/go/pkg/mod/github.com/rakyll/gotest@v0.0.2/main.go:155:8: cannot use c (type color.Attribute) as type *color.Color in assignment

I revert the following commit and the build was successful.

29d015f

go env

$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/kei.arima/Library/Caches/go-build"
GOENV="/Users/kei.arima/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/kei.arima/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/Users/kei.arima/.anyenv/envs/goenv/versions/1.14.1"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/Users/kei.arima/.anyenv/envs/goenv/versions/1.14.1/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/kei.arima/repos/github.com/rakyll/gotest/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/05/q4pw_wzx48vg9t899zwgjlyw0000gp/T/go-build433895382=/tmp/go-build -gno-recor
d-gcc-switches -fno-common"

I have the same issue and figured that during cffa99d commit you accidentally removed var c *color.Color.

I added var c *color.Color and changed fail = c to fail = color.Set(c) and trying to PR to your repo

func setPalette() {
	v := os.Getenv(paletteEnv)
	if v == "" {
		return
	}
	vals := strings.Split(v, ",")
	if len(vals) != 2 {
		return
	}
	if c, ok := colors[vals[0]]; ok {
		fail = color.Set(c)
	}
	if c, ok := colors[vals[1]]; ok {
		pass = color.New(c)
	}
}

FYI @kei2100 https://github.com/rakyll/gotest/releases/tag/v0.0.4 v0.0.4 was released and it resolved the issue you opened

@dojinkimm
Thank you for the information. I confirmed.