F
F
FairyTaleComposer2022-03-17 01:14:26
go
FairyTaleComposer, 2022-03-17 01:14:26

Why is the chi package not installed with go get?

I understand that the package should be installed in $GOPATH/src/github.com/go-chi/chi. But this doesn't work.
Although the following line is written in the go.mod of my project:
require github.com/go-chi/chi v1.5.4 //indirect
Go.sum is also created in the project folder. The terminal also says that the package has been added.
The code editor also swears that he did not find the module either in $GOROOT or in $GOPATH.
My project folder is in this path: $GOPATH/src/project

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
WinPooh32, 2022-03-17
@FairyTaleComposer

Wiki on GOPATH .
The GOPATH approach has been deprecated and as of 1.16, modules are used by default.
If you really need a project in GOPATH, then you can disable modules:
GO111MODULE=off go get github.com/go-chi/chi/v2
In modules mode, dependencies are stored in the cache.
They can be transferred to the project with the command go mod vendor, and the dependencies will be transferred to the vendor folder next to the go.mod file .
Dependencies are automatically downloaded into the cache when the project is built.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question