Skip to content

"missing dot in first path element" error for imports from vendor #35048

Closed
@xyt0056

Description

@xyt0056

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

$ go version
go1.13

Does this issue reproduce with the latest release?

yes

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

go env Output
$ go env

GO111MODULE=""
GOARCH="amd64"
GOBIN="/Users/me/go/bin"
GOCACHE="/Users/me/Library/Caches/go-build"
GOENV="/Users/me/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GONOPROXY="none"
GONOSUMDB="code.corp.internal"
GOOS="darwin"
GOPATH="/Users/me/go-code"
GOPRIVATE="code.corp.internal"
GOPROXY="https://proxy.corpinternal.com"
GOROOT="/private/var/tmp/_bazel_me/cde87e3334239cff91d2a561f734e9a6/external/go_sdk"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/private/var/tmp/_bazel_me/cde87e3334239cff91d2a561f734e9a6/external/go_sdk/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
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/nn/f16l5j1j2f14ctsnkk305lf00000gp/T/go-build790203101=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

upgrade to go1.13 and run go mod tidy

What did you expect to see?

finish successfully

What did you see instead?

missing dot in first path element

in go1.12, we have generated code(mocks etc.) in vendor folder and the code itself imports it by relative path in vendor.
here's our code structure

gopath/
    src/
        vendor/
            mock1/
        code.corp.internal/
            go.mod
            go.sum
            repo1/
            repo2/

in the code, we import it as import mock1/..., and this gives us error of "missing dot in first path element". What is the recommended way in this case?

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeWaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.modules

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions