revel / cmd

Command line tools for Revel.
MIT License
62 stars 100 forks source link

support go modules, panic: runtime error: invalid memory address or nil pointer dereference #195

Open lenghan4real opened 4 years ago

lenghan4real commented 4 years ago

go mod with dependency like golang.org/x/unix

[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x11d225d]

goroutine 59 [running]: go/ast.Walk(0x16aca80, 0xc010629260, 0x16afa60, 0x0) /Users/han/.gvm/gos/go1.13.5/src/go/ast/walk.go:224 +0x1b4d go/ast.Inspect(...) /Users/han/.gvm/gos/go1.13.5/src/go/ast/walk.go:385 github.com/revel/cmd/parser2.(*SourceInfoProcessor).getValidation(0xc000010040, 0xc0172e4ff0, 0xc013db7000, 0xc014a0c940) /workspace/revel_cmd/parser2/source_info_processor.go:114 +0x15f

notzippy commented 4 years ago

Can you give a short example? I tried a controller like this and was able to compile without issues

package controllers

import (
    "github.com/revel/revel"
    "golang.org/x/sys/unix"
    "os"
)

type App struct {
    *revel.Controller
}

func (c App) Index() revel.Result {
    unix.Exec("/bin/ls", []string{"ls", "-al"}, os.Environ())
    return c.Render()
}