Skip to content

how to add local module to vendor? #29079

Closed
@yanyandenuonuo

Description

@yanyandenuonuo

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

$ go version
go version go1.11.1 linux/amd64

Does this issue reproduce with the latest release?

yes, and i used the latest version

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

go env Output
$ go env

GOARCH="amd64"
GOBIN="/usr/local/go/bin"
GOCACHE="~/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="$Workspace/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build913779639=/tmp/go-build -gno-record-gcc-switches"

What did you do?

  1. create new project
  2. execute go mod init
  3. modify go.mod
exclude privaterepo.com/bb/bb
  1. copy my local module to vendor because the local module is on a private repo which not support https.
  2. now the vendor just like:
vendor
|-github.com/aa/aa
|-privaterepo.com/bb/bb
  1. import "privaterepo.com/bb/bb"
  2. execute go build -mod vendor
  3. than i got error "cannot find module for path privaterepo.com/bb/bb"
  4. i always try with replace, but it also not work
replace privaterepo.com/bb/bb v0.0.0 => ./vendor/privaterepo.com/bb/bb

What did you expect to see?

I just want go mod support i add local module and build success.

What did you see instead?

Before i used go dep which support ignored can solve the problem. Now go mod exclude not work for this.

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions