Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 392
bushbuckwhale Avatar asked Oct 22 '19 20:10

bushbuckwhale


3 Answers

Run the following before go build

go mod tidy
go mod vendor
like image 131
Amit Basuri Avatar answered Oct 21 '22 01:10

Amit Basuri


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.

like image 33
Markus Tenghamn Avatar answered Oct 21 '22 02:10

Markus Tenghamn


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.

like image 1
Alf Moh Avatar answered Oct 21 '22 02:10

Alf Moh