revel/cmd

revel package has issues

Closed this issue · 4 comments

When updating revel, the revel package command is broken

revel package okitoo/hackers_reloaded/main prod -v
INFO 14:49:38 command_config.go:152: Returned import path buildpath=/go path=okitoo/hackers_reloaded/main
INFO 14:49:38 file.go:346: Seeking app package app=okitoo/hackers_reloaded/main
INFO 14:49:38 file.go:354: Seeking remote package using=okitoo/hackers_reloaded/main remote=github.com/revel/revel
INFO 14:49:38 file.go:357: Resolved called Seeking remote package using=okitoo/hackers_reloaded/main remote=github.com/revel/revel
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x6331d5]

goroutine 1 [running]:
github.com/revel/cmd/utils.FindSrcPaths(0x7ffc4b99afc2, 0x1c, 0x8dc2c6, 0x16, 0x0, 0x0, 0x0, 0x815700, 0xc000095e60, 0xc00016dc68, ...)
/go/src/github.com/revel/cmd/utils/file.go:358 +0x4f5
github.com/revel/cmd/model.(*CommandConfig).SetVersions(0xc000140000, 0x8dae7b, 0x14)
/go/src/github.com/revel/cmd/model/command_config.go:301 +0xc0
github.com/revel/cmd/model.(*CommandConfig).UpdateImportPath(0xc000140000, 0x24, 0x3)
/go/src/github.com/revel/cmd/model/command_config.go:154 +0x68e
main.main()

only works if you do a "revel new" at least once.
as if some packages needs to be downloaded. maybe add this in the "go get -u " that we use to update revel

So it appears that if you are having this issue because some dependent packages were not already downloaded. If you do a revel run okitoo/hackers_reloaded/main does it work properly ?

Can't reproduce this anymore. Just like you said, there were missing packages that only "revel new" fetches but not 'revel package' (not sure about revel run and can't reproduce/try now).
This issue should be trivial

FYI, to reproduce, start as a new user or fresh computer and follow the Quick Start steps on the revel.github.io page — in a directory other than $GOPATH:

# get 'revel' framework and command
go get github.com/revel/cmd/revel

# Get the example apps
git clone https://github.com/revel/examples \
$GOPATH/src/github.com/revel/examples

# revel the chat app
revel run github.com/revel/examples/chat

and the result (on MacOS 10.14.6 with go 1.12.7):

$ revel run github.com/revel/examples/chat
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x123d711]

goroutine 1 [running]:
github.com/revel/cmd/utils.FindSrcPaths(0x7ffeefbfed2a, 0x1e, 0x1526a92, 0x16, 0x0, 0xc000188120, 0x0, 0x0, 0x4, 0x4, ...)
	/Users/lwest/go/src/github.com/revel/cmd/utils/file.go:358 +0x481
github.com/revel/cmd/model.(*CommandConfig).SetVersions(0xc000154000, 0x152565c, 0x14)
	/Users/lwest/go/src/github.com/revel/cmd/model/command_config.go:301 +0xcb
github.com/revel/cmd/model.(*CommandConfig).UpdateImportPath(0xc000154000, 0x10, 0x2)
	/Users/lwest/go/src/github.com/revel/cmd/model/command_config.go:154 +0x685
main.main()
	/Users/lwest/go/src/github.com/revel/cmd/revel/revel.go:94 +0x161

Now resolved with go.mod addition