无法安装Revel框架foo golang

时间:2018-09-28 14:17:00

标签: go revel

我尝试安装Revel Framework。我遵循了文档中给出的所有步骤,但是每当我尝试运行Revel命令时,它都会引发 panic 错误。 以下是我正在执行的步骤 环境路径:

allprojects {
  repositories {
    google()
    jcenter()
    // ...
  }
}

要安装Revel

export GOROOT=/usr/local/go
export GOPATH=/Users/<username>/Desktop/gocode
export PATH="/Users/<username>/gocode/bin:$PATH"

当我运行revel版本时,它显示:

go get github.com/revel/revel
go get github.com/revel/cmd/revel
export PATH="$PATH:$GOPATH/bin"

我跑步时

panic: runtime error: slice bounds out of range

goroutine 1 [running]:
github.com/revel/cmd/model.(*CommandConfig).UpdateImportPath(0xc4200961c0, 0x20)
    /Users/amitsharma/Desktop/gocode/src/github.com/revel/cmd/model/command_config.go:122 +0x907
main.main()
    /Users/amitsharma/Desktop/gocode/src/github.com/revel/cmd/revel/revel.go:133 +0x243

它显示

revel run -a my-app

我的Go版本

ERROR 19:34:59 harness.go:231: Could not start application              error="revel/harness: app died reason: exit status 2"
INFO  19:34:59 watcher.go:272: Watcher: Recording error last build, setting rebuild on error="App failed to start up: revel/harness: app died reason: exit status 2"
INFO  19:34:59 watcher.go:277: Rebuilt, result                          error="App failed to start up: revel/harness: app died reason: exit status 2"

我的去环保

go version go1.10.3 darwin/amd64

谢谢

1 个答案:

答案 0 :(得分:0)

尝试重新安装狂欢

这是我尝试过的方法,它对我有用。

  1. 设置执行路径($ GOPATH):
export GOPATH=/var/projects/go
  1. 安装revel和cmd:
  go get github.com/revel/revel
  go get github.com/revel/cmd/revel
  1. 将revel cmd链接到bin目录。因此该命令可以执行。
export PATH="$PATH:$GOPATH/bin
  1. 检查发布是否正常。只需在命令行
  2. 中输入revel

输出将是这样

    Usage:
      revel [OPTIONS] <command>

    Application Options:
      -v, --debug              If set the logger is set to verbose
          --historic-run-mode  If set the runmode is passed a string not json
      -X, --build-flags=       These flags will be used when building the application. May be specified multiple times, only applicable for Build, Run,
                               Package, Test commands

    Available commands:
      build
      clean
      new
      package
      run
      test
      version
  1. 检查发布版本:
revel version

输出

    Revel executing: displays the Revel Framework and Go version
    Revel Framework :   0.21.0  (0.21.0 remote master branch)
    Revel Cmd   :   0.21.1  (0.21.1 remote master branch)
    Revel Modules   :   0.21.0  (0.21.0 remote master branch)
  1. 现在,您可以使用命令
  2. 创建第一个项目。
revel new myapp

输出

    Revel executing: create a skeleton Revel application
    Your application has been created in:
       /var/projects/go/src/myapp

    You can run it with:
    revel run -a  myapp