I installed almost 10 days ago golang in my Ubuntu 18.04.01 Server Edition:
go version
go version go1.10.4 linux/amd64
The GOPATH set in .bashrc is this:
export GOPATH=$HOME/go
export PATH=${PATH}:${GOPATH}/bin
and I've been using golang since then. Today I tried to install beego but happens something really strange:
go get -u github.com/astaxie/beego
go get -u github.com/beego/bee
The binary file is installed in a very long, and actually strange and absurd path:
marco@pc01:~/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:
/sbin:/bin:/usr/games:/usr/local/games:/snap/bin$ ls -lah
total 16M
drwxrwxr-x 2 marco marco 4.0K Jan 30 17:14 .
drwxrwxr-x 3 marco marco 4.0K Jan 30 17:14 ..
-rwxrwxr-x 1 marco marco 16M Jan 30 17:14 bee
While the src beego directory seems correctly installed:
/home/marco/go/src/github.com/beego/bee
What is strange, again, is that if try to execute this simple go code:
package main
import (
"github.com/astaxie/beego"
)
type MainController struct {
beego.Controller
}
func (this *MainController) Get() {
this.Ctx.WriteString("hello world")
}
func main() {
beego.Router("/", &MainController{})
beego.Run()
}
go run helloBeego.go
2019/01/30 17:37:06.139 [I] http server Running on http://:8080
And in the web browser I actually get:
hello world
But when I try to create a bee project:
/go/src$ bee new my-first-beego-project
Command 'bee' not found, did you mean:
command 'be' from deb bugs-everywhere
command 'btee' from deb ruby-bcat
command 'beef' from deb beef
command 'bbe' from deb bbe
command 'ben' from deb ben
command 'beet' from deb beets
command 'beep' from deb beep
command 'see' from deb mime-support
command 'ree' from deb ree
command 'pee' from deb moreutils
command 'beer' from deb gerstensaft
command 'tee' from deb coreutils
command 'bel' from deb belier
I guess that the absurd path in which bee binary is put and the fact that creation of bee project with 'bee new' command fails are related problems. How to solve them? Looking forward to your kind help. Marco
Added info, as rightly requested:
marco@pc01:~$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/marco/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/marco/go"
GORACE=""
GOROOT="/usr/lib/go-1.10"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go-1.10/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-
map=/tmp/go-build461259545=/tmp/go-build -gno-record-gcc-switches"
marco@pc01:~$
Version of beego:
v1.6.2