bushbuckwhale
bushbuckwhale

Reputation: 361

Fixing go: inconsistent vendoring in C:\Go\src

I recently started learning Go programming language for Web and now I can't build my project. I'm getting "inconsistent vendoring". I checked github and the library is missing i.e. (Actually the library is still there but with no v0.1.0) vscode error type on build

Upvotes: 26

Views: 25546

Answers (4)

James Anyalewechi
James Anyalewechi

Reputation: 1

I was having the same problem recently, all I had to do was remove the go.mod and go.sum files I created in my C:User\go\src directory.

I guess this happens because go.mod is meant to be used outside your working directory and since these files are located in the source directory, you don't need

Upvotes: -1

Uberswe
Uberswe

Reputation: 1058

This problem can also occur if you vendor/modules.txt file is missing. This happened in a project that gitignored *.txt and the solution was simply to commit this file and then follow what @amit-basuri wrote in his answer.

Upvotes: 4

Alf Moh
Alf Moh

Reputation: 7427

On windows:

Initially, I had my packages in C\:Go\src. It turns out that, go creates other directories in C:\Users\USERNAME\go\src\. I therefore moved my (personal) packages into the C:\Users\USERNAME\go\src\ folder and those from github into the C:\Users\USERNAME\go\src\github.com folder. Everything started working again.

Upvotes: 1

Amit Basuri
Amit Basuri

Reputation: 613

Run the following before go build

go mod tidy
go mod vendor

Upvotes: 38

Related Questions