E
E
egorggegor2022-03-25 09:18:27
go
egorggegor, 2022-03-25 09:18:27

Why can't VS Code see local packages?

Hello!

Switched from goland to VS Code, local packages are highlighted in red, although the project is running. Is there anything that can be done about this?

623d5e6f720c6624054151.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
kvaks, 2022-03-25
@kvaks

GOPATH and GOROOT were registered in the goland IDE.
You can add them to VS Code or figure out the paths and where the packages and the project should be

W
WinPooh32, 2022-03-29
@WinPooh32

Use modules.
The GOPATH approach is deprecated and only exists for backwards compatibility.
https://go.dev/blog/using-go-modules
https://go.dev/ref/mod
To use local packages in modules, use replace to specify the path to them.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question