Coder Social home page Coder Social logo

cmd's Introduction

cmd's People

Contributors

anonx avatar brendensoares avatar fyb3roptik avatar glaslos avatar helgix avatar jeevatkm avatar krhubert avatar kumakichi avatar laur1nmartins avatar lujiacn avatar mattbaird avatar mei-rune avatar nathantchan avatar notzippy avatar ottob avatar pedromorgan avatar ptman avatar pushrax avatar rnubel avatar roblillack avatar sergeylanzman avatar shawncatz avatar shinypb avatar timo-md avatar tqwewe avatar tw4452852 avatar verdverm avatar vin01 avatar yuki2006 avatar yyoshiki41 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cmd's Issues

go get github.com/revel/cmd/revel fails with undefined in revel/cmd/harness?

Running go get github.com/revel/cmd/revel

results in the following errors:

No change to our repo. We use the heroku buildpack with dokku. Never had problems until today. What's going on? Sometimes happens on our local machine sometimes does not. Always happens on our vm which is ubuntu 14.04. go version 1.5.1 revel 0.13

# github.com/revel/cmd/harness
../.go_workspace/src/github.com/revel/cmd/harness/harness.go:94: undefined: revel.HTTPAddr
../.go_workspace/src/github.com/revel/cmd/harness/harness.go:97: undefined: revel.HTTPSsl
../.go_workspace/src/github.com/revel/cmd/harness/harness.go:118: undefined: revel.HTTPSsl
../.go_workspace/src/github.com/revel/cmd/harness/harness.go:174: undefined: revel.HTTPAddr
../.go_workspace/src/github.com/revel/cmd/harness/harness.go:174: undefined: revel.HTTPPort
../.go_workspace/src/github.com/revel/cmd/harness/harness.go:178: undefined: revel.HTTPSsl
../.go_workspace/src/github.com/revel/cmd/harness/harness.go:181: undefined: revel.HTTPSslCert
../.go_workspace/src/github.com/revel/cmd/harness/harness.go:182: undefined: revel.HTTPSslKey
../.go_workspace/src/github.com/revel/cmd/harness/harness.go:224: undefined: revel.HTTPSsl
../.go_workspace/src/github.com/revel/cmd/harness/reflect.go:431: undefined: revel.RevelImportPath
../.go_workspace/src/github.com/revel/cmd/harness/reflect.go:431: too many errors

-X flag requires argument of the form importpath.name=value

I am getting following error on running revel app in development mode. I am posting logs below

INFO  2016/06/14 16:18:17 build.go:172: Cleaning dir tmp
INFO  2016/06/14 16:18:17 build.go:172: Cleaning dir routes
2016/06/14 16:18:17 reflect.go:728: Failed to generate name for field. Make sure the field name is valid.
2016/06/14 16:18:17 reflect.go:728: Failed to generate name for field. Make sure the field name is valid.
2016/06/14 16:18:17 reflect.go:728: Failed to generate name for field. Make sure the field name is valid.
INFO  2016/06/14 16:18:17 build.go:172: Cleaning dir tmp
INFO  2016/06/14 16:18:17 build.go:172: Cleaning dir routes
ERROR 2016/06/14 16:18:19 build.go:101: # api-core/app/tmp
/home/deploy/.gvm/gos/go1.6/pkg/tool/linux_amd64/link: -X flag requires argument of the form importpath.name=value

ERROR 2016/06/14 16:18:19 build.go:298: Failed to parse build errors:
 # api-core/app/tmp
/home/deploy/.gvm/gos/go1.6/pkg/tool/linux_amd64/link: -X flag requires argument of the form importpath.name=value

Also on running revel build I am getting following error

deploy@ip-172-xx-xx-x9 ~/api-core $ revel build api-core ./buiding1
~
~ revel! http://revel.github.io
~
INFO  2016/06/15 15:52:51 revel.go:365: Loaded module static
INFO  2016/06/15 15:52:51 revel.go:230: Initialized Revel v0.13.1 (2016-06-06) for >= go1.4
INFO  2016/06/15 15:52:51 build.go:172: Cleaning dir tmp
INFO  2016/06/15 15:52:51 build.go:172: Cleaning dir routes
2016/06/15 15:52:51 reflect.go:728: Failed to generate name for field. Make sure the field name is valid.
2016/06/15 15:52:51 reflect.go:728: Failed to generate name for field. Make sure the field name is valid.
2016/06/15 15:52:51 reflect.go:728: Failed to generate name for field. Make sure the field name is valid.
INFO  2016/06/15 15:52:51 build.go:172: Cleaning dir tmp
INFO  2016/06/15 15:52:51 build.go:172: Cleaning dir routes
TRACE 2016/06/15 15:52:51 build.go:94: Exec: [/home/deploy/.gvm/gos/go1.6/bin/go build -ldflags -X api-core/app.APP_VERSION "" -tags  -o /home/deploy/api-core/bin/revel.d/api-core/api-core api-core/app/tmp]
ERROR 2016/06/15 15:52:54 build.go:101: # api-core/app/tmp
/home/deploy/.gvm/gos/go1.6/pkg/tool/linux_amd64/link: -X flag requires argument of the form importpath.name=value

ERROR 2016/06/15 15:52:54 build.go:298: Failed to parse build errors:
 # api-core/app/tmp
/home/deploy/.gvm/gos/go1.6/pkg/tool/linux_amd64/link: -X flag requires argument of the form importpath.name=value

Please help me with this issue.
I am using v0.12.0

DefaultValidationKeys generated with wrong line for multiline check

Consider the following code for validation:

20    ...
21    func (u *User) Validate(v *revel.Validation) {
22        v.Check(u.Username,
23            revel.ValidRequired(),
24            revel.ValidMinSize(3),
25            revel.ValidMaxSize(255))
26    }
27    ...

And this is what revel/cmd will generate in tmp/main.go:

revel.DefaultValidationKeys = map[string]map[int]string{ 
    "github.com/lokhman/revel-test/app/models.(*User).Validate": { 
        25: "u.Username",
    },
}

Line 25 from the generated code is the last line of a multiline statement, whereas runtime.Caller(2) from revel/validation.go will return line 22. Due to this bug keys in validation errors become empty "".

(Revel 0.19; Go 1.9.2 linux/amd64)

More helpers

Ok so here is me working on a new revel project..

and I kinda want more command..
eg
new controller

revel create controller Foo
create app/foo.go{y}
Controller Go Name = Foo(y} >
Create view foo/index.html (y)

make it easy for boiler plate

Skeleton prod config generates invalid log filenames

log.warn.output = log/%(app.name)-warn.json # Log all warn messages to file
log.error.output = log/%(app.name)-error.json # Log all errors to file
log.crit.output = log/%(app.name)-critical.json # Log all critical to file

%(app.name) should be %(app.name)s

Because of the missing s, the resulting log names (when printed from cli):

jlangevin$ ls log/
%(app.name)-critical.json
%(app.name)-error.json
%(app.name)-warn.json
my-app-name-requests.json

Note the requests log is the only one that has the correct format in the generated config.

Remove error prone command line options

Multiple command line options are error prone and call for weird guesses in code (see #78 , #77)
This proposal is to move the run mode and the port number into there own flagged parameters so they are not confused with the command or import path

panic occurs when trying to execute `revel run` on a specific case

Overview

If there is a function which takes an argument of type interface{} in controller layers, it would be panic when executing revel run.

Reproduction procedure

The following is an example procedure to reproduce this problem.

  1. Set up Revel tools.
go get github.com/revel/revel
go get github.com/revel/cmd/revel
  1. Initialize skeleton application with revel new -a XXX
  2. Add following code into app/controllers/app.go.
func (c *App) Debug(data interface{}) revel.Result {
  return nil
}
  1. Run revel run -a XXX

Then, a panic like below occurs.

Revel executing: run a Revel application
WARN  16:21:13 harness.go:170: No http.addr specified in the app.conf listening on localhost interface only. This will not allow external access to your application
panic: interface conversion: interface {} is *ast.Ident, not string

goroutine 1 [running]:
github.com/revel/cmd/logger.findInContext(0x14a1858, 0x6, 0xc4202e2dc0, 0x4, 0x4, 0xc42017e250, 0x1011b56)
  /Users/usk83/go/src/github.com/revel/cmd/logger/format.go:99 +0x13c
github.com/revel/cmd/logger.TerminalFormatHandler.func1(0xc4201c6630, 0xc4202b5150, 0x76, 0xc4202b5150)
  /Users/usk83/go/src/github.com/revel/cmd/logger/format.go:56 +0xd4
github.com/revel/log15.formatFunc.Format(0xc42013afc0, 0xc4201c6630, 0xc420280a80, 0xc4202764da, 0x3)
  /Users/usk83/go/src/github.com/revel/log15/format.go:34 +0x30
github.com/revel/log15.StreamHandler.func1(0xc4201c6630, 0x76, 0xc42017e588)
  /Users/usk83/go/src/github.com/revel/log15/handler.go:43 +0x4f
github.com/revel/log15.funcHandler.Log(0xc42016a8a0, 0xc4201c6630, 0xc4200269f8, 0xc42017e638)
  /Users/usk83/go/src/github.com/revel/log15/handler.go:31 +0x30
github.com/revel/log15.SyncHandler.func1(0xc4201c6630, 0x0, 0x0)
  /Users/usk83/go/src/github.com/revel/log15/handler.go:57 +0x91
github.com/revel/log15.funcHandler.Log(0xc42013afe0, 0xc4201c6630, 0x148e0c0, 0x1b006c8)
  /Users/usk83/go/src/github.com/revel/log15/handler.go:31 +0x30
github.com/revel/log15.LazyHandler.func1(0xc4201c6630, 0xc4202e2dc0, 0xc4202b5160)
  /Users/usk83/go/src/github.com/revel/log15/handler.go:295 +0x2ed
github.com/revel/log15.funcHandler.Log(0xc42013b000, 0xc4201c6630, 0x2, 0x2)
  /Users/usk83/go/src/github.com/revel/log15/handler.go:31 +0x30
github.com/revel/log15.CallerFileHandler.func1(0xc4201c6630, 0xc4201c6630, 0x0)
  /Users/usk83/go/src/github.com/revel/log15/handler.go:101 +0x164
github.com/revel/log15.funcHandler.Log(0xc42013b020, 0xc4201c6630, 0xc42017e7d0, 0x1145ee0)
  /Users/usk83/go/src/github.com/revel/log15/handler.go:31 +0x30
github.com/revel/cmd/logger.(*CompositeMultiHandler).Log(0xc4200ac960, 0xc4201c6630, 0x90, 0x146bc60)
  /Users/usk83/go/src/github.com/revel/cmd/logger/handlers.go:224 +0x68
github.com/revel/log15.(*swapHandler).Log(0xc420062730, 0xc4201c6630, 0x1220e32, 0xc42030e120)
  /Users/usk83/go/src/github.com/revel/log15/handler_go14.go:14 +0x77
github.com/revel/log15.(*logger).write(0xc42009ef00, 0x14ba680, 0x3d, 0x2, 0xc42030e120, 0x2, 0x2)
  /Users/usk83/go/src/github.com/revel/log15/logger.go:108 +0x237
github.com/revel/log15.(*logger).Warn(0xc42009ef00, 0x14ba680, 0x3d, 0xc42030e120, 0x2, 0x2)
  /Users/usk83/go/src/github.com/revel/log15/logger.go:154 +0x66
github.com/revel/cmd/parser.appendAction(0xc42026e840, 0xc42017ec38, 0x14fd860, 0xc420263d70, 0xc4201ed900, 0x13, 0xc420276420, 0xb, 0xc42017ec08)
  /Users/usk83/go/src/github.com/revel/cmd/parser/appends.go:137 +0x903
github.com/revel/cmd/parser.processPackage(0xc42026e840, 0xc4201ed900, 0x13, 0xc420282320, 0x42, 0xc420263dd0, 0x0)
  /Users/usk83/go/src/github.com/revel/cmd/parser/reflect.go:174 +0x97a
github.com/revel/cmd/parser.(*processContainer).processPath(0xc4201d4060, 0xc420282320, 0x42, 0x14fff60, 0xc4202040d0, 0x0, 0x0, 0xc420282320, 0x42)
  /Users/usk83/go/src/github.com/revel/cmd/parser/reflect.go:139 +0x4fd
github.com/revel/cmd/parser.(*processContainer).(github.com/revel/cmd/parser.processPath)-fm(0xc420282320, 0x42, 0x14fff60, 0xc4202040d0, 0x0, 0x0, 0x0, 0x0)
  /Users/usk83/go/src/github.com/revel/cmd/parser/reflect.go:48 +0x69
github.com/revel/cmd/utils.fsWalk.func1(0xc420282320, 0x42, 0x14fff60, 0xc4202040d0, 0x0, 0x0, 0x0, 0xc42017f2c8)
  /Users/usk83/go/src/github.com/revel/cmd/utils/file.go:237 +0x1a5
path/filepath.walk(0xc420282230, 0x42, 0x14fff60, 0xc4202040d0, 0xc4201d4090, 0x0, 0x0)
  /Users/usk83/.gvm/gos/go1.10.2/src/path/filepath/path.go:361 +0xe5
path/filepath.walk(0xc420022cc0, 0x36, 0x14fff60, 0xc4201de000, 0xc4201d4090, 0x0, 0x30)
  /Users/usk83/.gvm/gos/go1.10.2/src/path/filepath/path.go:381 +0x2c2
path/filepath.Walk(0xc420022cc0, 0x36, 0xc4201d4090, 0x0, 0xc42002e067)
  /Users/usk83/.gvm/gos/go1.10.2/src/path/filepath/path.go:403 +0x106
github.com/revel/cmd/utils.fsWalk(0xc420022cc0, 0x36, 0xc420022cc0, 0x36, 0xc4201ca020, 0x1, 0xc4201ca020)
  /Users/usk83/go/src/github.com/revel/cmd/utils/file.go:239 +0xa4
github.com/revel/cmd/utils.Walk(0xc420022cc0, 0x36, 0xc4201ca020, 0x7, 0x0)
  /Users/usk83/go/src/github.com/revel/cmd/utils/file.go:200 +0x49
github.com/revel/cmd/parser.ProcessSource(0xc42014c500, 0xc42017f8e0, 0x2, 0x2)
  /Users/usk83/go/src/github.com/revel/cmd/parser/reflect.go:48 +0x184
github.com/revel/cmd/harness.Build(0xc420152000, 0xc42014c500, 0xe, 0x0, 0x0)
  /Users/usk83/go/src/github.com/revel/cmd/harness/build.go:43 +0xc0
github.com/revel/cmd/harness.(*Harness).Refresh(0xc42008a780, 0x0)
  /Users/usk83/go/src/github.com/revel/cmd/harness/harness.go:217 +0xd4
github.com/revel/cmd/watcher.(*Watcher).notifyInProcess(0xc4200da700, 0x14f8840, 0xc42008a780, 0x0)
  /Users/usk83/go/src/github.com/revel/cmd/watcher/watcher.go:270 +0x10a
github.com/revel/cmd/watcher.(*Watcher).Notify(0xc4200da700, 0x0)
  /Users/usk83/go/src/github.com/revel/cmd/watcher/watcher.go:214 +0x3f5
github.com/revel/cmd/harness.(*Harness).Run(0xc42008a780)
  /Users/usk83/go/src/github.com/revel/cmd/harness/harness.go:269 +0x19d
main.runApp(0xc420152000, 0x17, 0x2)
  /Users/usk83/go/src/github.com/revel/cmd/revel/run.go:144 +0x7bd
main.main()
  /Users/usk83/go/src/github.com/revel/cmd/revel/revel.go:103 +0x20c

Investigation

I made sure that this error happens with both 0.20.0 and 0.21.0-dev of revel.

On the previous version of revel (0.19.1), this panic does not appear. Instead, a warning like below is shown, maybe as expected.

WARN  16:33:02  revel reflect.go:460: Didn't understand argument 'data' of action (*App).Debug. Ignoring.

As far as I debugged, findInContext in github.com/revel/cmd/logger/format.go received an unexpected argument of ctx when an error occurred, and the value of ctx then was outputted as follows as %+v format.

[]interface {}{(*ast.Ident)(0xc4202b2940), "(*App).Debug", "caller", "appends.go:137"}

Supplements

Here are my environment.

OS: Mac OS X 10.11.6
Go: go1.10.2 (installed through gvm)

% echo $GOPATH
/Users/usk83/go:/Users/usk83/.gvm/pkgsets/go1.10.2/global
% echo $GOROOT
/Users/usk83/.gvm/gos/go1.10.2
% which go
/Users/usk83/.gvm/gos/go1.10.2/bin/go
% which revel
/Users/usk83/go/bin/revel

Although I've considered resolving this problem by myself, this seems something complicated with a parser or any other revel cores. For that reason, I've just submitted an issue.

This problem fully blocks some programs to work, it can not even start up. I hope this issue would be resolved.

Regards,

ignoring files

It would be really great if the revel cmd can ignore files on build/package. I have a quite large bower_components directory which is not needed at all on deployment.

Print test result on failure to console

I am using travis and if something fails I see in the log

Some tests failed.  See file:///.../test-results for results.

That's not very helpful. Why not simply printing the stack to stdout?

Cheers,
Lukas

// edit:

Currently I am using something like this as a workaround:

find test-results -name '*.failed.html' |while read file; do
  echo -e "\033[0;31m$file\033[0m";
  cat $file |tr '\n' ';' |grep -oP '(?<=<code class="bash">).*?(?=</code>)' \
    | sed -r 's/\);\s*/\)\n/g';
  echo -e "\n\n";
done

revel panics with invalid memory address or nil pointer dereference

Currently when we create the build target directory in the same path as that of the revel panics

Pradheep testapp $ pwd
/Users/Pradheep/mailbox/src/testapp
Pradheep testapp $ revel build testapp ./tmp/
~
~ revel! http://revel.github.io
~
INFO 2015/10/12 12:56:55 revel.go:329: Loaded module static
INFO 2015/10/12 12:56:55 revel.go:206: Initialized Revel v0.12.0 (2015-03-25) for >= go1.3
INFO 2015/10/12 12:56:55 build.go:172: Cleaning dir tmp
INFO 2015/10/12 12:56:55 build.go:172: Cleaning dir routes
INFO 2015/10/12 12:56:55 build.go:172: Cleaning dir tmp
INFO 2015/10/12 12:56:55 build.go:172: Cleaning dir routes
TRACE 2015/10/12 12:56:55 build.go:94: Exec: [/usr/local/bin/go build -ldflags -X testapp/app.APP_VERSION "" -tags -o /Users/Pradheep/mailbox/bin/revel.d/testapp/testapp testapp/app/tmp]
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x20 pc=0xec40

goroutine 1 [running]:
main.main.func2()
/Users/Pradheep/mailbox/src/github.com/revel/cmd/revel/rev.go:71 +0x5b
main.mustCopyDir.func1(0xc8201e9c00, 0x3f7, 0x0, 0x0, 0xb64680, 0xc820369710, 0x0, 0x0)
/Users/Pradheep/mailbox/src/github.com/revel/cmd/revel/util.go:96 +0x2b0c820185668, 0x0, 0x0)
/usr/local/Cellar/go/1.5.1/libexec/src/path/filepath/path.go:374 +0x4fc
path/filepath.walk(0xc820190400, 0x3b3, 0xb646a8, 0xc8203fa500, 0xc820185668, 0x0, 0x0)
/usr/local/Cellar/go/1.5.1/libexec/src/path/filepath/path.go:374 +0x4fc
path/filepath.walk(0xc82052e000, 0x3ab, 0xb646a8, 0xc820014f00, 0xc820185668, 0x0, 0x0)
/usr/local/Cellar/go/1.5.1/libexec/src/path/filepath/path.go:374 +0x4fc
path/filepath.walk(0xc8200a8400, 0x387, 0xb646a8, 0xc820370280, 0xc820185668, 0x0, 0x0)
/usr/local/Cellar/go/1.5.1/libexec/src/path/filepath/path.go:374 +0x4fc
path/filepath.walk(0xc82044c000, 0x383, 0xb646a8, 0xc820015a40, 0xc820185668, 0x0, 0x0)
/usr/local/Cellar/go/1.5.1/libexec/src/path/filepath/path.go:374 +0x4fc
path/filepath.walk(0xc82029a700, 0x37b, 0xb646a8, 0xc8200148c0, 0xc820185668, 0x0, 0x0)
/usr/local/Cellar/go/1.5.1/libexec/src/path/filepath/path.go:374 +0x4fc
path/filepath.walk(0xc820067c00, 0x377, 0xb646a8, 0xc8200147d0, 0xc820185668, 0x0, 0x0)
/usr/local/Cellar/go/1.5.1/libexec/src/path/filepath/path.go:374 +0x4fc
path/filepath.walk(0xc820353500, 0x373, 0xb646a8, 0xc8203fb2c0, 0xc820185668, 0x0, 0x0)
/usr/local/Cellar/go/1.5.1/libexec/src/path/filepath/path.go:374 +0x4fc
path/filepath.walk(0xc8203e7c00, 0x36b, 0xb646a8, 0xc820015ea0, 0xc820185668, 0x0, 0x0)
/usr/local/Cellar/go/1.5.1/libexec/src/path/filepath/path.go:374 +0x4fc
path/filepath.walk(0xc8204b7500, 0x367, 0xb646a8, 0xc820015e00, 0xc820185668, 0x0, 0x0)
/usr/local/Cellar/go/1.5.1/libexec/src/path/filepath/path.go:374 +0x4fc
path/filepath.walk(0xc82059c000, 0x363, 0xb646a8, 0xc82033eb90, 0xc820185668, 0x0, 0x0)
/usr/local/Cellar/go/1.5.1/libexec/src/path/filepath/path.go:374 +0x4fc
path/filepath.walk(0xc8205bd180, 0x35b, 0xb646a8, 0xc8203fbbd0, 0xc820185668, 0x0, 0x0)
/usr/local/Cellar/go/1.5.1/libexec/src/path/filepath/path.go:374 +0x4fc
path/filepath.walk(0xc8205e6a80, 0x357, 0xb646a8, 0xc8203fb7c0, 0xc820185668, 0x0, 0x0)
/usr/local/Cellar/go/1.5.1/libexec/src/path/filepath/path.go:374 +0x4fc
path/filepath.walk(0xc8204d5c00, 0x353, 0xb646a8, 0xc8200154f0, 0xc820185668, 0x0, 0x0)
/usr/local/Cellar/go/1.5.1/libexec/src/path/filepath/path.go:374 +0x4fc
path/filepath.walk(0xc8204a6e00, 0x34b, 0xb646a8, 0xc820014500, 0xc820185668, 0x0, 0x0)
/usr/local/Cellar/go/1.5.1/libexec/src/path/filepath/path.go:374 +0x4fc
path/filepath.walk(0xc820225180, 0x347, 0xb646a8, 0xc8203700f0, 0xc820185668, 0x0, 0x0)
/usr/local/Cellar/go/1.5.1/libexec/src/path/filepath/path.go:374 +0x4fc
path/filepath.walk(0xc820438380, 0x343, 0xb646a8, 0xc8203fa230, 0xc820185668, 0x0, 0x0)
/usr/local/Cellar/go/1.5.1/libexec/src/path/filepath/path.go:374 +0x4fc
path/filepath.walk(0xc820481180, 0x33b, 0xb646a8, 0xc82033f400, 0xc820185668, 0x0, 0x0)
/usr/local/Cellar/go/1.5.1/libexec/src/path/filepath/path.go:374 +0x4fc
path/filepath.walk(0xc82047ea80, 0x337, 0xb646a8, 0xc82033f360, 0xc820185668, 0x0, 0x0)
/usr/local/Cellar/go/1.5.1/libexec/src/path/filepath/path.go:374 +0x4fc
path/filepath.walk(0xc82029aa80, 0x333, 0xb646a8, 0xc820382000, 0xc820185668, 0x0, 0x0)
/usr/local/Cellar/go/1.5.1/libexec/src/path/filepath/path.go:374 +0x4fc
path/filepath.walk(0xc82034c700, 0x32b, 0xb646a8, 0xc8203fba90, 0xc820185668, 0x0, 0x0)
/usr/local/Cellar/go/1.5.1/libexec/src/path/filepath/path.go:374 +0x4fc
path/filepath.walk(0xc8205c2000, 0x327, 0xb646a8, 0xc8203fb810, 0xc820185668, 0x0, 0x0)
/usr/local/Cellar/go/1.5.1/libexec/src/path/filepath/path.go:374 +0x4fc
path/filepath.walk(0xc8202d3b00, 0x2e7, 0xb646a8, 0xc820014be0, 0xc820185668, 0x0, 0x0)
/usr/local/Cellar/go/1.5.1/libexec/src/path/filepath/path.go:374 +0x4fc
path/filepath.walk(0xc8201f2900, 0x2e3, 0xb646a8, 0xc8203fb4f0, 0xc820185668, 0x0, 0x0)
/usr/local/Cellar/go/1.5.1/libexec/src/path/filepath/path.go:374 +0x4fc
path/filepath.walk(0xc82019c900, 0x2db, 0xb646a8, 0xc8203fa320, 0xc820185668, 0x0, 0x0)
/usr/local/Cellar/go/1.5.1/libexec/src/path/filepath/path.go:374 +0x4fc
path/filepath.walk(0xc820356c00, 0x2d3, 0xb646a8, 0xc8200149b0, 0xc820185668, 0x0, 0x0)
/usr/local/Cellar/go/1.5.1/libexec/src/path/filepath/path.go:374 +0x4fc0, 0x0)
/usr/local/Cellar/go/1.5.1/libexec/src/path/filepath/path.go:374 +0x4fc
path/filepath.walk(0xc820173a00, 0x1f7, 0xb646a8, 0xc82033f540, 0xc820185668, 0x0, 0x0)
............
goroutine 17 [syscall, locked to thread]:
runtime.goexit()
/usr/local/Cellar/go/1.5.1/libexec/src/runtime/asm_amd64.s:1696 +0x1

goroutine 5 [syscall]:
os/signal.loop()
/usr/local/Cellar/go/1.5.1/libexec/src/os/signal/signal_unix.go:22 +0x18
created by os/signal.init.1
/usr/local/Cellar/go/1.5.1/libexec/src/os/signal/signal_unix.go:28 +0x37

However it doesnot panic if the destination path is some other folder outside the revel path

Failed to parse port as integer: prod

This issue stems from the below pull:
#56

Edge case of running:
revel run my-app prod

Causes this error to pop up. Quick fix is to do the following:

reve run my-app/ prod

Custom vendoring panics revel

I have a project with a custom vendoring solution which breaks with the revel tool.

My folder layout is something like this:

.
└── src
    └── myorg
        ├── cmd
        │   ├── program1
        │   └── program2
        ├── vendor
        │   └── src
        │       └── github.com
        │           └── revel
        │               ├── cmd
        │               │   └── revel
        │               └── revel
        └── web
            └── my-revel-proj
                ├── app
                ├── conf
                ├── messages
                └── public

(inside the /vendor/src dir are all other 3rd party dependencies, just not listed here)
Then I build my project with a makefile which does this to build program1, program2:

export GOPATH="/go-work/src/myorg/vendor:/go-work/src/myorg/../.." && go install myorg/cmd/...

To build revel (the cmd tool):

export GOPATH="/go-work/src/myorg/vendor:/go-work/src/myorg/../.." && go install github.com/revel/cmd/revel

But then when I try to run the web site with

export GOPATH="/go-work/src/myorg/vendor:/go-work/src/myorg/../.." && vendor/bin/revel run myorg/web/my-revel-proj

The result is a panic:

INFO  2014/08/05 18:09:49 revel.go:320: Loaded module static
INFO  2014/08/05 18:09:49 run.go:57: Running my-revel-proj (myorg/cmd/my-revel-proj) in dev mode
ERROR 2014/08/05 18:09:49 template.go:196: error walking templates: lstat templates: no such file or directory
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
    panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x6247d9]

goroutine 16 [running]:
runtime.panic(0x894c00, 0xb8f793)
    /usr/local/go/src/pkg/runtime/panic.c:279 +0xf5
main.func·002()
    /go-work/src/myorg/vendor/src/github.com/revel/cmd/revel/rev.go:71 +0x7b
runtime.panic(0x894c00, 0xb8f793)
....

Refactor path.* => filepath.* case by case

To make Revel more compatible with the targeted operating system-defined file paths. Goal is prevent OS related filesystem path issues.

Example:
From

path.*

To

filepath.*

revel -v --version version

All the command above "switches" to be accepted..

but also it most report current version vs future etc..

Potential CSRF vulnerability associated with skeleton's catch-all route

Hi, I noticed that the skeleton project includes a catch all route that maps any HTTP verb to the named controller/action:

*       /:controller/:action                    :controller.:action

This creates a potential security vulnerability by allowing GET requests to access state-changing routes while bypassing CSRF protection. I know Revel doesn't bundle CSRF protection, but the standard behavior is to only check CSRF tokens on state-changing methods like POST/PUT/DELETE, and not for GET/OPTIONS/HEAD/etc. This is the behavior of existing Revel CSRF prevention libraries, and also for frameworks like Ruby on Rails, Yesod (Haskell), etc.

So I might have routing like this:

POST    /transfers                                  TransfersController.Create
*       /:controller/:action                    :controller.:action

and assume in my TransfersController.Create that some before interceptor has checked for a CSRF token, because I said that only POST maps to that method. But an attacker could pretty easily guess my controller name/action, and do:

GET /transferscontroller/create to hit my endpoint, and because it's a GET request CSRF protection would have been bypassed, allowing the attacker to make transfers for any user visiting their site.


This may sound theoretical if you're not familiar with CSRF attacks, but this exact same situation (using catch-all routes) led to huge security vulnerabilities for Ruby on Rails users, which researcher Egor Homakov demonstrated by showing vulnerabilities in major sites like Tumblr and Justin.tv. Because of these vulnerabilities the Rails team removed catch-all routes ("match").

I think the Revel should:

  1. At least remove catch-all routes from the skeleton project
  2. Recommend to existing Revel users to remove the catch-all route
  3. Consider dropping support for the catch-all route altogether.

Edit: I wasn't sure if this is the best repo for reporting this issue—I wasn't sure where exactly the Revel skeleton code is kept, but I know the command-line tool generates it.

'Import path' treated inconsistently between 'run' and 'build/package/clean/test'

revel run, with no additional parameters, works perfectly when the current directory is the project root.

revel build, package, clean, and test only work if the import_path parameter is explicitly provided.

It is unclear by reading the documentation if this is intended behavior or not for revel run.

Personally, I think assuming the import_path as . if not provided would be a great QoL improvement.

add `revel develop` command

the scenrrio is that..

One is hacking away at an application..

  • and using stable master version

But one want to switch to the "develop" mode and thus

  • test revel stuff against future
  • allow hacking of code etc..

So idea is to create command

  • revel develop on = will grab latest revel branch and head
  • revel develop off = will switch back to previous code
  • this means all repos will have to switch..

so basically is doing a

  • git checkout revel/cmd
  • git checkout revel/revel
  • git checkout revel/modules
  • git checkout revel/skeleton
    and switching between "stable" and next versions is the isea..

It a pain in the ass to do this manually

Also we need to chack whether we can create a remote head easy and integrate with github..
eg a
go get gh/revel/skeletons = htttp ??
but now I wanna branch
and its a pain to have to go thru that caper..
so mabybe we can get revel to branch off automatically and help

Revel and Versioning

Each time revel updates, all my docker builds break as the recommended way to get the revel cmd is by the go get command.

Can a dependency file please be created and maintained? Go Deps or Glide, or something?

Docs Issues

Can someone from the core team explain how I

  • go and hack revel/cmd/revel
    ie how to modify go and go run..

Need to add this to the manual

  • pattern/recipie for creating a new comand

`revel` CLI command args vs flags

This could apply to other revel commands as well, but we need to standardize and document the convention.

Each command, like new has required and optional fields.

  • Required fields SHOULD directly follow the command in a defined sequenced eg. revel new APPNAME
  • Optional fields SHOULD use flags eg. -opt value or -opt=val following the required fields.

revel cmd installation failing

Hi,
Installation for revel cmd started failing from morning. This has affected our deployment. Please help. Below is log for same

installing github.com/revel/cmd/revel ... 2017/06/07 20:29:39 failed installing packages: failed building package github.com/revel/cmd/revel, error: # github.com/revel/modules/testrunner/app/controllers
../../modules/testrunner/app/controllers/testrunner.go:124: revel.MainTemplateLoader.TemplateLang undefined (type *revel.TemplateLoader has no field or method TemplateLang)
, output: %!s(MISSING): exit status 2 [exit status 2 github.com/dkulchenko/bunch/packages.go:234: failed building package github.com/revel/cmd/revel, error: # github.com/revel/modules/testrunner/app/controllers
../../modules/testrunner/app/controllers/testrunner.go:124: revel.MainTemplateLoader.TemplateLang undefined (type *revel.TemplateLoader has no field or method TemplateLang)
, output: %!s(MISSING) github.com/dkulchenko/bunch/packages.go:643: ]

revel dev

the "dev" command will..

Check all the gh/revel/ repos and swithc modes

revel dev master  // stable
revel dev develop // next gen

the command checkout and switched modules, revel et all accordingly..

run shell commands before build

I use Revel with angular and foundation. I compile the required JS manually into one minified JS file, and I compile the necessary SASS files into one minified CSS. It would be really great if Revel can do this compiling automatically for me on build/package.

update banner message

The banner message printed when revel starts needs to be updated to revel.github.io

Latest changes break revel

just updated revel, created a new package

without changin anything, ran revel run (my pacakge name)

source_info.go:100: Type found in package: controllers, but did not embed from: revel.Controller name=FileInformation importpath=github.com/revel/modules/static/app/controllers foundstructures=Static,TestRunner,App

I can't find the "FileInformation" struct anywhere in my src directory let alone the package
I think this bug is from the latest vendors updates

Start a new project to rebuild revel command

Currently the way revel cmd operates is that it is basically a bunch of function calls that dynamically build a couple of go files and launches them. The cmd program continues to run in the background (when in developer mode) to watch for source file changes and if detected it will trigger a rebuild and reload. This is all done with code that is loosely coupled together, and does not support unit testing.

I think the best approach at this point is to start with a fresh project on this that does the same thing but is developed in a way that supports the following

  • Unit Testing
  • A pluggable architecture for new types of revel applications
  • Extend existing applications by adding new controllers and components

Then at some point in the future we will switch from revel/cmd to revel/run

Add ability to generate a skeleton framework that would be a pure restful interface, preferably using RAML (http://raml.org/) - Restful API Modeling Language. or maybe pluggable to use multiple

References
https://github.com/kishorevaishnav/revelgen
https://github.com/xeipuuv/gojsonschema

Aggregate from issues
revel/revel#968
revel/revel#120

Enhancements

  • Symlink directory resolver, go through the GOPATH directory structure to try and detect a temp file creation, the temp file will be created initially.
  • Swagger / Raml support. The general support for these have been to generate routes based on the configuration data. Then stub out a controller class with the method call.
  • Unit testing.
  • Configuration file detection changes
  • Source file detection changes
  • Template file detection changes
  • Custom build arguments #10

undefined: revel.Walk on go get

We use the revel command in this package to run the tests locally and on CircleCI.
It was working fine and it still works fine on my machine (with an older version of the packages) but it started to fail on CircleCI with the following error:

go get github.com/revel/cmd/revel
../.go_workspace/src/github.com/revel/cmd/harness/reflect.go:99: undefined: revel.Walk

go get github.com/revel/cmd/revel returned exit code 2

Action failed: go get github.com/revel/cmd/revel

We use godep for the rest of the dependencies but we install revel using go get which unfortunately can't get a specific/older version of a package.

Something must have changed recently. Any ideas or possible workarounds?

"Runtime error: Invalid memory address" when starting app

From @lezorich on December 18, 2017 21:19

I'm currently working with revel 0.18.0 and golang 1.9. Everything was working fine, but now when I try to start the app with revel run I started to get this exception:

DEBUG 17:54:15  revel harness.go:146: Rebuild Called                            
INFO  17:54:15  revel  build.go:235: Cleaning dir tmp                          
INFO  17:54:15  revel  build.go:235: Cleaning dir routes                       
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x749e41]

goroutine 1 [running]:
main.main.func2()
        /home/administrador/go/src/github.com/revel/cmd/revel/rev.go:86 +0x6b
panic(0x882440, 0xb88a50)                                                                                                                                        
        /usr/lib/go-1.9/src/runtime/panic.go:491 +0x283
go/ast.Walk(0xb56320, 0xc420527e80, 0xb57f20, 0x0)
        /usr/lib/go-1.9/src/go/ast/walk.go:224 +0x1b51
go/ast.Inspect(0xb57f20, 0x0, 0xc420527e80)
        /usr/lib/go-1.9/src/go/ast/walk.go:385 +0x4b
github.com/revel/cmd/harness.getValidationKeys(0xc4202aa5c0, 0xc42041f170, 0xc4203ce510, 0xc420397ce0)
        /home/administrador/go/src/github.com/revel/cmd/harness/reflect.go:550 +0xed
github.com/revel/cmd/harness.processPackage(0xc4202aa5c0, 0xc4203b8dc0, 0x44, 0xc420397ce0, 0x5f, 0xc420452870, 0x0)
        /home/administrador/go/src/github.com/revel/cmd/harness/reflect.go:245 +0x352
github.com/revel/cmd/harness.ProcessSource.func1(0xc420397ce0, 0x5f, 0xb5e3a0, 0xc420454dd0, 0x0, 0x0, 0x0, 0x0)
        /home/administrador/go/src/github.com/revel/cmd/harness/reflect.go:185 +0x524
github.com/revel/revel.fsWalk.func1(0xc420397ce0, 0x5f, 0xb5e3a0, 0xc420454dd0, 0x0, 0x0, 0x0, 0x0)
        /home/administrador/go/src/github.com/revel/revel/util.go:272 +0x1bf
path/filepath.walk(0xc420397c20, 0x5f, 0xb5e3a0, 0xc420454dd0, 0xc420354420, 0x0, 0x0)
        /usr/lib/go-1.9/src/path/filepath/path.go:356 +0x81
path/filepath.walk(0xc420397800, 0x59, 0xb5e3a0, 0xc4204548f0, 0xc420354420, 0x0, 0x0)
        /usr/lib/go-1.9/src/path/filepath/path.go:381 +0x3a0
path/filepath.walk(0xc4203b8d20, 0x50, 0xb5e3a0, 0xc420454680, 0xc420354420, 0x0, 0x0)
        /usr/lib/go-1.9/src/path/filepath/path.go:381 +0x3a0
path/filepath.walk(0xc4202e5a40, 0x46, 0xb5e3a0, 0xc420525040, 0xc420354420, 0x0, 0x0)
        /usr/lib/go-1.9/src/path/filepath/path.go:381 +0x3a0
path/filepath.walk(0xc4203a2880, 0x3b, 0xb5e3a0, 0xc420170000, 0xc420354420, 0x0, 0x0)
        /usr/lib/go-1.9/src/path/filepath/path.go:381 +0x3a0
path/filepath.walk(0xc42001b040, 0x34, 0xb5e3a0, 0xc4203afd40, 0xc420354420, 0x0, 0x30)
        /usr/lib/go-1.9/src/path/filepath/path.go:381 +0x3a0
path/filepath.Walk(0xc42001b040, 0x34, 0xc420354420, 0xc420038a80, 0x7f96aba996c8)
        /usr/lib/go-1.9/src/path/filepath/path.go:403 +0x11d
github.com/revel/revel.fsWalk(0xc42001b040, 0x34, 0xc42001b040, 0x34, 0xc4203543f0, 0xc420195601, 0xc4203543f0)
        /home/administrador/go/src/github.com/revel/revel/util.go:274 +0xa9
github.com/revel/revel.Walk(0xc42001b040, 0x34, 0xc4203543f0, 0x19, 0xb1)
        /home/administrador/go/src/github.com/revel/revel/util.go:222 +0x49
github.com/revel/cmd/harness.ProcessSource(0xc4200110c0, 0x4, 0x4, 0xc42002b370, 0xc42002b300)
        /home/administrador/go/src/github.com/revel/cmd/harness/reflect.go:106 +0x2b8
github.com/revel/cmd/harness.Build(0x0, 0x0, 0x0, 0x0, 0x0)
        /home/administrador/go/src/github.com/revel/cmd/harness/build.go:35 +0xe5
github.com/revel/cmd/harness.(*Harness).Refresh(0xc4202cacc0, 0x0)
        /home/administrador/go/src/github.com/revel/cmd/harness/harness.go:147 +0xe2
github.com/revel/revel.(*Watcher).Notify(0xc4202c6910, 0x0)
        /home/administrador/go/src/github.com/revel/revel/watcher.go:178 +0x274
github.com/revel/cmd/harness.(*Harness).Run(0xc4202cacc0)
        /home/administrador/go/src/github.com/revel/cmd/harness/harness.go:186 +0x190
main.runApp(0xc4200100e0, 0x2, 0x2)
        /home/administrador/go/src/github.com/revel/cmd/revel/run.go:131 +0x47b
main.main()
        /home/administrador/go/src/github.com/revel/cmd/revel/rev.go:94 +0x3c9

What can be going on?

Copied from original issue: revel/revel#1286

panic: runtime error: slice bounds out of range

When running revel version outside of $GOPATH. Also, even though I tried to clean out sources, binaries and packages, and then installed revel using go get -u -v github.com/revel/cmd/revel, I get this from revel version (inside $GOPATH):

Revel executing: displays the Revel Framework and Go version

Revel Framework
Information not available (not on GOPATH)

Revel Command Utility Tool
Version 0.20.0-dev
Build Date 2018-02-06
Minimum Go Version >= go1.8

I'm sure it was built today, not 2018-02-06.

`revel new` app name new file path

Due to the many ways to define the app name and location, it can end in an unexpected result.

For example: revel new $GOPATH/myapp would end up in $GOPATH/src/myapp.

To avoid confusion, we SHOULD either:

  • explicitly show the resulting file path of the new app project (based on clever rules of interpretation)
  • deny ambiguous values (instead of being clever).

PS - we'll also need to document the rules how values are handled

Repo cmd/{revel, harness} - coding convention for logger

Currently cmd repo uses following:

  • errorf(...
  • fmt.Fprintf(os.Stderr...
  • revel.{ERROR,...}...

To improve & keep consistent codebase across Revel. After v0.13 release, I will circle back to this. I would like to use either revel.{loggers} or fmt.{...}

Any thoughts?

BUG: wrong samples

The cmd currently shows

 github.com/revel/revel/samples/chat

instead of

   github.com/revel/samples/chat

eg
For example, to run the chat room sample application:

revel run github.com/revel/revel/samples/chat dev

Add exclude .go sources option

Based on this discursion

As a revel packager
I want to exclude .go files from the zipped file generated by revel package command
Because Is not wanted for me share my source files with the final user

A example, the chat sample. When I run

$ revel build github.com/revel/samples/chat /tmp/chat-build prod # or revel package

It generates the follow tree. This way my source code is exposed to the final user, I want that all files be compiled to the binary and no one source file be exposed.

.
├── chat
├── run.bat
├── run.sh
└── src
    └── github.com
        └── revel
            ├── modules
            │   ├── static
            │   │   └── app
            │   │       └── controllers
            │   │           └── static.go
            │   └── testrunner
            │       ├── app
            │       │   ├── controllers
            │       │   │   └── testrunner.go
            │       │   ├── plugin.go
            │       │   └── views
            │       │       └── TestRunner
            │       │           ├── FailureDetail.html
            │       │           ├── Index.html
            │       │           └── SuiteResult.html
            │       ├── conf
            │       │   └── routes
            │       └── public
            │           ├── css
            │           │   ├── bootstrap.min.css
            │           │   └── github.css
            │           ├── images
            │           │   └── favicon.png
            │           └── js
            │               ├── bootstrap.min.js
            │               ├── highlight.pack.js
            │               └── jquery-1.9.1.min.js
            ├── revel
            │   ├── conf
            │   │   └── mime-types.conf
            │   └── templates
            │       └── errors
            │           ├── 403.html
            │           ├── 403.json
            │           ├── 403.txt
            │           ├── 403.xml
            │           ├── 404-dev.html
            │           ├── 404.html
            │           ├── 404.json
            │           ├── 404.txt
            │           ├── 404.xml
            │           ├── 405.html
            │           ├── 405.json
            │           ├── 405.txt
            │           ├── 405.xml
            │           ├── 500-dev.html
            │           ├── 500.html
            │           ├── 500.json
            │           ├── 500.txt
            │           └── 500.xml
            └── samples
                └── chat
                    ├── app
                    │   ├── chatroom
                    │   │   └── chatroom.go
                    │   ├── controllers
                    │   │   ├── app.go
                    │   │   ├── longpolling.go
                    │   │   ├── refresh.go
                    │   │   └── websocket.go
                    │   ├── routes
                    │   │   └── routes.go
                    │   ├── tmp
                    │   │   └── main.go
                    │   └── views
                    │       ├── Application
                    │       │   └── Index.html
                    │       ├── footer.html
                    │       ├── header.html
                    │       ├── LongPolling
                    │       │   └── Room.html
                    │       ├── Refresh
                    │       │   └── Room.html
                    │       └── WebSocket
                    │           └── Room.html
                    ├── conf
                    │   ├── app.conf
                    │   └── routes
                    ├── public
                    │   ├── images
                    │   │   └── favicon.png
                    │   ├── javascripts
                    │   │   ├── jquery-1.5.min.js
                    │   │   ├── jquery.scrollTo-min.js
                    │   │   └── templating.js
                    │   └── stylesheets
                    │       └── main.css
                    └── tests
                        └── apptest.go

revel reinstall

This is a new command that..

Nukes all existance of a machine.. and reinstalls the whole revel platform to latest version..

Good luck but we are pre v.1.0 and therefor we can play right ;_)

Also we can do revel switch which makes it easy for me to crap out and start again ;-)

Custom build args to revel package

Please add a way to pass build flags when running / building with revel.

I have a number of (rest)services all using the same structure and then one web site made with revel. For the services I have a makefile which pass in date and git revision as ldflags, and a couple of build tags.

In the end it becomes something like this

go install -tags="gm no_development" -ldflags "-X myorg/version.date $(DATE) -X myorg/version.version $(GITREV)"

I would like the same to be passed to our revel web site, so that I can reuse our existing code to track version and compilation date, and so that we can use 3rd party libs which use build tags.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.