Search code examples
gogo-gin

Problem with installation of Gin via 'go get github.com/gin-gonic/gin'


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.


Solution

  • 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.