[SOLVED] http.Transport issue - external dependency


One of the tools I use (godog) has a dependency on go-cleanhttp. I’m getting the following error when I try to compile the code

failed to compile package steps:
# github.com/hashicorp/go-cleanhttp
/go/src/github.com/hashicorp/go-cleanhttp/cleanhttp.go:29: unknown http.Transport field 'DialContext' in struct literal
/go/src/github.com/hashicorp/go-cleanhttp/cleanhttp.go:30: unknown http.Transport field 'MaxIdleConns' in struct literal
/go/src/github.com/hashicorp/go-cleanhttp/cleanhttp.go:31: unknown http.Transport field 'IdleConnTimeout' in struct literal

I’m using go version go1.8.1 linux/amd64. If I open the source code in my IDE there are no compilation errors. It also appears to have no issues on my other PC which uses go version go1.8 linux/amd64 (although this may not be related)

As mentioned - this is not a library I’ve chosen myself however I have removed and reinstalled just in case - no success. Can anyone offer any advice on how to resolve or workaround?

Are you sure?

$ go version
go version go1.8.1 linux/amd64


It’s been setup in the last fortnight. No other versions have ever been installed

And you get the error above when running go get -u github.com/hashicorp/go-cleanhttp using that Go?

No error when I run that.

Then you need to tell us what you’re doing to get the error in question. :slight_smile:

I mentioned in my first post. It happens on compilation or more often trying to run the godog BDD tests. It may be an issue with godog but the error suggests that the http.transport is not picking up the new API (which is why I know you asked about the version)

There is nothing in your first post or here that lets me reproduce what you’re doing. Maybe you’re running some script that’s using Docker to build using an older compiler. Maybe there’s a vendored http library in the way. Maybe something entirely different. We can’t know, so we can’t help you.

Ok no problem. It does seems to be an issue that’s been picked up elsewhere.

I’m not sure what else to tell you other than I’m trying to run godog tests. I’ll figure it out :smiley:

Those guys are all using old compilers. You could point to the code you are trying to compile and show the commands you are running, but sure, let us know when it’s figured out. :slight_smile:

AH yeah - rookie mistake. Seems the tests were running in a docker container using Go 1.6. Thanks

1 Like

Please mark this question solved.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.