Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid memory address or nil pointer dereference #8

Closed
jcloutz opened this issue Apr 5, 2017 · 5 comments
Closed

Invalid memory address or nil pointer dereference #8

jcloutz opened this issue Apr 5, 2017 · 5 comments

Comments

@jcloutz
Copy link

jcloutz commented Apr 5, 2017

I'm not sure if this is due to the permissions issue or not but the app will only build on the initial run. When I save a file it crashes immediately.

$ refresh run
Refresh (1.3.2)

refresh-log: 2017/04/04 21:37:21 === Rebuild on: :start: ===
refresh-log: 2017/04/04 21:37:21 === Running: go build -v -i -o tmp/sundial (PID: 36468) ===
github.com/jcloutz/sundial
refresh-log: 2017/04/04 21:37:21 === Building Completed (PID: 36468) (Time: 130.067865ms) ===
refresh-log: 2017/04/04 21:37:21 === fork/exec tmp/sundial: permission denied
 ===
refresh-log: 2017/04/04 21:37:45 === Rebuild on: sundial.go ===
refresh-log: 2017/04/04 21:37:45 === Running: go build -v -i -o tmp/sundial (PID: 36534) ===
github.com/jcloutz/sundial
refresh-log: 2017/04/04 21:37:45 === Building Completed (PID: 36534) (Time: 233.783206ms) ===
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x113aeef]

goroutine 1 [running]:
github.com/markbates/refresh/refresh.(*Manager).runner(0xc4200167d0)
	/Users/jeremyc/develop/GoCode/src/github.com/markbates/refresh/refresh/runner.go:18 +0x12f
github.com/markbates/refresh/refresh.(*Manager).Start(0xc4200167d0, 0x12ff800, 0xc420018600)
	/Users/jeremyc/develop/GoCode/src/github.com/markbates/refresh/refresh/manager.go:72 +0xec
github.com/markbates/refresh/cmd.RunWithContext(0x1215f2b, 0xb, 0x12ff840, 0xc4200145e8)
	/Users/jeremyc/develop/GoCode/src/github.com/markbates/refresh/cmd/run.go:38 +0xe6
github.com/markbates/refresh/cmd.Run(0x1215f2b, 0xb)
	/Users/jeremyc/develop/GoCode/src/github.com/markbates/refresh/cmd/run.go:27 +0x4d
github.com/markbates/refresh/cmd.glob..func3(0x1314e40, 0x1331208, 0x0, 0x0)
	/Users/jeremyc/develop/GoCode/src/github.com/markbates/refresh/cmd/run.go:21 +0x39
github.com/spf13/cobra.(*Command).execute(0x1314e40, 0x1331208, 0x0, 0x0, 0x1314e40, 0x1331208)
	/Users/jeremyc/develop/GoCode/src/github.com/spf13/cobra/command.go:648 +0x231
github.com/spf13/cobra.(*Command).ExecuteC(0x1314c20, 0xc42006e058, 0x0, 0x1316300)
	/Users/jeremyc/develop/GoCode/src/github.com/spf13/cobra/command.go:734 +0x339
github.com/spf13/cobra.(*Command).Execute(0x1314c20, 0x1314c20, 0xc42004bf50)
	/Users/jeremyc/develop/GoCode/src/github.com/spf13/cobra/command.go:693 +0x2b
github.com/markbates/refresh/cmd.Execute()
	/Users/jeremyc/develop/GoCode/src/github.com/markbates/refresh/cmd/root.go:21 +0x31
main.main()
	/Users/jeremyc/develop/GoCode/src/github.com/markbates/refresh/main.go:6 +0x20
@markbates
Copy link
Owner

If you fix the permissions on the tmp folder does it work for you? I've never seen a permission denied error before for this.

@jcloutz
Copy link
Author

jcloutz commented Apr 5, 2017

So I realized that I think this may be my fault and I wasn't paying attention to the configuration. I have the following folder structure.

| app/
|-- main.go
|-- cmd/
| http/
| sundial.go
| refresh.yml

Full source : https://github.com/jcloutz/sundial

to run it in dev I would run go run app/main.go serve. Can i do that with refresh? This is my config.

app_root: app/
ignored_folders:
- vendor
- logs
- tmp
- bin
included_extensions:
- .go
build_path: tmp/
build_delay: 200ns
binary_name: sundial
command_flags: [serve]
enable_colors: true
log_name: "sundial-log"

@jcloutz
Copy link
Author

jcloutz commented Apr 5, 2017

I'm still getting the same error though, and permissions on tmp is 755 with proper owner/group

@markbates
Copy link
Owner

Ok, I was able to reproduce this using your app. The problem is you're running refresh run in the root directory. There isn't a main function there, so it's not executable. If you run it inside your app folder then it builds just fine.

@jcloutz
Copy link
Author

jcloutz commented Apr 5, 2017

@markbates thank you! I had a feeling it was user error :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants