constabulary/gb

test fails to find standard lib import

Closed this issue · 5 comments

bndw commented

gb test is failing to find the net/http/httptest subdirectory

// src/foo/foo_test.go
package main

import (
	"net/http/httptest"
	"testing"
)

func TestFoo(t *testing.T) {
	_ = httptest.NewRequest("", "https://example.com", nil)
}
$ gb test -a
foo_test.go:9: undefined: httptest.NewRequest
FATAL command "test" failed: exit status 2

I'm not able to reproduce this issue, see #681 for a test that confirms this.

Hmm, looks like httptest may not have existed in 1.6 and earlier. Let me check.

Yup, httptest.NewRequest was added in Go 1.7.

If you have upgraded your Go installation you must rebuild gb. Sorry about this limitation, it's not an easy one to overcome.

bndw commented

@davecheney Thanks for the lightning fast followup and resolution!