Skip to content

go test error with ' use of internal package not allowed' #21710

@chenjie4255

Description

@chenjie4255

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version go1.8.3 darwin/amd64
go version go1.8.1 darwin/amd64

Does this issue reproduce with the latest release?

no, but it have another problem, which says that the type (in gopath) doest not match the type in govendor folder.

cannot use r (type "github.com/pressly/chi".Router) as type "git.moreless.io/valkyrie/vendor/github.com/pressly/chi".Router in argument to userHandler.RegisterSessionURL:

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/chenjie/Workspace/GO"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/l6/m31j3rrd1hgfm4yc1vx7c07h0000gn/T/go-build184980144=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"

What did you do?

go test ./...

What did you expect to see?

test succeed

What did you see instead?

vendor/github.com/garyburd/redigo/redis/pool.go:28:2: use of internal package not allowed
vendor/github.com/smartystreets/assertions/equality.go:11:2: use of internal package not allowed
vendor/github.com/smartystreets/assertions/collections.go:7:2: use of internal package not allowed
vendor/gopkg.in/mgo.v2/auth.go:38:2: use of internal package not allowed
vendor/gopkg.in/mgo.v2/bson/json.go:7:2: use of internal package not allowed

those package are all ok, the only different is the files above import a path include "xxx/xxx/internal/xxx", how does the error happen?

for example, the vendor/gopkg.in/mgo.v2/bson.json.go:7:2 is look like:

import (
	"bytes"
	"encoding/base64"
	"fmt"
	"gopkg.in/mgo.v2/internal/json"
	"strconv"
	"time"
)

If I removed the vendor folder, the go test run well, BTW, I build the vendor folder using govendor tool.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions