Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/go: Inconsistent vendoring detected. Please re-run "go mod vendor" #45103

Closed
mtalhasaleem502 opened this issue Mar 18, 2021 · 5 comments
Closed
Labels
FrozenDueToAge modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@mtalhasaleem502
Copy link

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

$ go version
go version go1.15.7 

Does this issue reproduce with the latest release?

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

$ go env

set GO111MODULE=on
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\Faizii\AppData\Local\go-build
set GOENV=C:\Users\Faizii\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\Faizii\Go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\Faizii\Go;
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\GO
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=C:\GO\pkg\tool\windows_amd64
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=C:\Users\Faizii\Go\src\c\chess\go.mod
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\Faizii\AppData\Local\Temp\go-build578196042=/tmp/go-build -gno-record-gcc-switches

my_project.zip

What did you do?

After getting the any package with "go get " command or after changing the version of package in my go.mod file, then I used the "go mod vendor" it started to give the following error:

Inconsistent vendoring detected. Please re-run "go mod vendor".
See #39164 for more detail on this issue.

What did you expect to see?

I need to import the package and want to accessing its functionalities

What did you see instead?

Inconsistent vendoring detected. Please re-run "go mod vendor".
See #39164 for more detail on this issue.

@bcmills
Copy link
Contributor

bcmills commented Mar 18, 2021

What was the output when you ran go mod vendor? (Did it succeed?)

@bcmills bcmills added modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Mar 18, 2021
@bcmills bcmills added this to the Backlog milestone Mar 18, 2021
@seankhliao
Copy link
Member

and how was this vendor directory created / filled? it has things like .git/ that go shouldn't be adding

@mtalhasaleem502
Copy link
Author

mtalhasaleem502 commented Mar 18, 2021

@bcmills @seankhliao I did add some packages manually in vendor directory but my project was working accurately, even after running the "go mod vendor" it was saying on those packages that " xyz: package xyz is not in GOROOT (C:\GO\src\xyz) ". But every thing was going smooth and working.
After getting the any package with "go get " command or after changing the version of package in my go.mod file, then I used the "go mod vendor" it started to give the following error in module name:

Inconsistent vendoring detected. Please re-run "go mod vendor".
image

@seankhliao seankhliao changed the title Inconsistent vendoring detected. Please re-run "go mod vendor". See https://github.com/golang/go/issues/39164 for more detail on this issue. cmd/go: Inconsistent vendoring detected. Please re-run "go mod vendor" Mar 18, 2021
@bcmills
Copy link
Contributor

bcmills commented Mar 19, 2021

@mtalhasaleem502, go mod vendor requires that all packages transitively imported by your program be supplied by dependencies of your module. If any are missing, it attempts to supply them itself.

In order for go mod vendor to supply a missing dependency, it needs either a path that it can fetch from the Internet (that is, one that begins with the domain name where the dependency is hosted), or a path that it can find via a replace directive in your go.mod file.

Package paths like Authentication and CHK certainly cannot be fetched from the Internet, so they must instead be supplied by replace directives.

See https://golang.org/doc/modules/managing-dependencies#unpublished.

@bcmills bcmills added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Mar 19, 2021
@mtalhasaleem502
Copy link
Author

@bcmills @seankhliao Thank you so much I have completed successfully with your best support. I have learnt many things. "go mod vendor " was not working due to the addition of local packages manually in vendor directory. When I used the replace directives it started to work accurately. Again Thanks.

@bcmills bcmills closed this as completed Mar 19, 2021
@golang golang locked and limited conversation to collaborators Mar 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

4 participants