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

Templates don't seem to be found #18

Open
ismith opened this issue May 19, 2017 · 4 comments
Open

Templates don't seem to be found #18

ismith opened this issue May 19, 2017 · 4 comments

Comments

@ismith
Copy link
Contributor

ismith commented May 19, 2017

If I cd to $GOPATH/src/github.com/flexd/slackinviter/main.go, slackinviter -h runs fine; if not, main.go can't find templates/index.tmpl.

@ismith
Copy link
Contributor Author

ismith commented May 19, 2017

(This is after installing via go get.)

@flexd
Copy link
Owner

flexd commented May 19, 2017 via email

@dmitshur
Copy link

You can use something like this to find the directory corresponding to an import path inside GOPATH, and os.Chdir into it during command initialization:

https://github.com/go-gl/example/blob/ee0644b7c5650555db3c0f4d04f9ef5716e6c6ac/gl21-cube/cube.go#L207-L228

@ismith
Copy link
Contributor Author

ismith commented May 21, 2017

Not the go run case - slackinviter is in my PATH, so it can be run from any cwd; but parseFiles loads relative to the cwd. I'll open a PR if I can figure out a way to do this that doesn't break the build. (go-bindata uses go generate, which is nice, but isn't integrated with go build AFAIK.)

I suspect the same issue affects the contents of static/.

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