1

大约 10 天前,我在我的 Ubuntu 18.04.01 服务器版中安装了 golang:

go version
go version go1.10.4 linux/amd64

.bashrc 中设置的 GOPATH 是这样的:

export GOPATH=$HOME/go
export PATH=${PATH}:${GOPATH}/bin

从那以后我一直在使用 golang。今天我尝试安装beego,但发生了一些非常奇怪的事情:

go get -u github.com/astaxie/beego
go get -u github.com/beego/bee

二进制文件安装在一个很长,实际上很奇怪和荒谬的路径中:

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

虽然 src beego 目录似乎已正确安装:

/home/marco/go/src/github.com/beego/bee

再次奇怪的是,如果尝试执行这个简单的 go 代码:

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

在网络浏览器中,我实际上得到:

hello world 

但是当我尝试创建一个蜜蜂项目时:

/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

我猜想放置bee二进制文件的荒谬路径以及使用“bee new”命令创建bee项目失败的事实是相关的问题。如何解决它们?期待您的帮助。马可

根据正确要求添加了信息:

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:~$

beego版本:

v1.6.2
4

0 回答 0