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

Unable to compile #6

Closed
AlbinOS opened this issue Jun 21, 2016 · 3 comments
Closed

Unable to compile #6

AlbinOS opened this issue Jun 21, 2016 · 3 comments

Comments

@AlbinOS
Copy link

AlbinOS commented Jun 21, 2016

Sorry to bother you again but I cannot make your sample work.

My error is :

~/Projects/go/ » go version
go version go1.6.2 linux/amd64
~/Projects/go/ » echo $GOPATH
/home/albin/Projects/go
~/Projects/go/ » go get github.com/go-authboss/authboss-sample    
~/Projects/go/src/github.com/go-authboss/authboss-sample » go run blog.go
# command-line-arguments
./blog.go:45: undefined: NewMemStorer
./blog.go:82: undefined: NewCookieStorer
./blog.go:83: undefined: NewSessionStorer
./blog.go:129: undefined: cookieStore
./blog.go:130: undefined: sessionStore
./blog.go:145: undefined: authProtect
./blog.go:146: undefined: authProtect
./blog.go:150: undefined: authProtect
./blog.go:151: undefined: authProtect
./blog.go:199: undefined: blogs
./blog.go:151: too many errors

I don't really understand as for example : NewMemStorer which is in storer.go is in the same package as blog.go. It should find it no ? What am I missing ? Something wrong with my setup ?

@kris-runzer
Copy link
Contributor

If you want to use go run you must specify all the files:
~/.../authboss-sample>go run blog.go blogs.go middleware.go cookie_storer.go session_storer.go storer.go

Perhaps the simpler approach is to just use go build

Linux:
~/.../authboss-sample>go build && ./authboss sample

Windows:
~/.../authboss-sample>go build && authboss sample.exe

@AlbinOS
Copy link
Author

AlbinOS commented Jun 21, 2016

Ok, thanks a lot for the tip.

I tried go build but I was giving blog.go in parameter.

Could you please explain me the difference between this sample application and a 'typical' go application ? For my Gin based web app, I can just run go run on the main file and everything is founded without the need of specifying all of the dependency files.

@aarondl
Copy link
Member

aarondl commented Jul 24, 2016

Authboss -is- a typical Go application. It's your lack of knowledge of the Go toolchain that's making you believe otherwise. go run only works when you pass it all files required to run the project, go build uses package structure to dictate which files to use.

@aarondl aarondl closed this as completed Jul 24, 2016
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

3 participants