Search code examples
gorevel

Cannot install revel framework form Go


I tried to install Revel Framework. I followed all the steps as given in the documentation but whenever I tried to run the Revel command it throws panic error. Following are the steps which I am performing Enviormental path:

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

To install Revel

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

when I run revel version it shows:

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

When I run

revel run -a my-app

It shows

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"

My go version

go version go1.10.3 darwin/amd64

My go env

GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/amitsharma/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/<username>/Desktop/gocode"
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/0d/pkfrs5cj0v57xgsnwvb2kb580000gn/T/go-build028697826=/tmp/go-build -gno-record-gcc-switches -fno-common"

Solution

  • Try re-install the revel

    Here is how I have tried and it works for me.

    1. Set the go path ($GOPATH):
    export GOPATH=/var/projects/go
    
    1. Install revel & cmd:
      go get github.com/revel/revel
      go get github.com/revel/cmd/revel
    
    1. Link revel cmd to bin directory. So the command could be executable.
    export PATH="$PATH:$GOPATH/bin
    
    1. Check revel is working or not. Just type revel in command line

    Output would be like this

        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. Check revel version:
    revel version
    

    Output

        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. Now, You can create first project using command
    revel new myapp
    

    Output

        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