1
votes

I am trying to install Gin but facing the following issues in the Ubuntu terminal:

/go/src$ go get github.com/gin-gonic/gin
package github.com/gin-gonic/gin: no Go files in /home/user/go/src/github.com/gin-gonic/gin

When I use -u the error is a bit another:

/go/src$ go get -u github.com/gin-gonic/gin
package github.com/gin-gonic/gin: directory "/home/user/go/src/github.com/gin-gonic/gin" is not using a known version control system

I tried a hard installation:

sudo apt-get install -y golang-github-gin-gonic-gin-dev

but there is a lot of inconvenience like lib/pq disappears when saving- mean mod.go doesn't permit installation and when running main.go in Gin project -> facing the following issue:

Lec13$ go run main.go
routes/routes.go:4:2: package Lec13/controllers is not in GOROOT (/usr/local/go/src/Lec13/controllers)

Maybe someone knows the way to figure this issue out?

Thanks in advance.

1
CAn you post your folder/file structure? Do you have a module go.mod, go.sum in your root path?Danizavtz
Hi @Danizavtz , sure: /go/src/github.com/RaminCH_self/Go_lev.2_RestAPI/Lec13$ , yup I have both go.mod and go.sum , I did go mod init in the beginningR.Chopurov
here is one detail: in /go/src/github.com I have another folder that I had before during the lessons /go/src/github.com/RaminCH/go2_REST_API/lec13 (master)$ and here the main.go runsR.Chopurov
It seems like the folder RaminCH has master privileges but RaminCH_self don't, maybe you know how I can shift ?R.Chopurov
You can edit your question to provide informationDanizavtz

1 Answers

0
votes

If you are sure go is installed in your system, you can try to add golang to your $path variables.

export PATH=$PATH:$HOME/go/bin

And then you can try again.