can't run present
amsmac011:GoCourse lsanmartin$ ./present_and_share.sh
cannot find module providing package golang.org/x/tools/cmd/present: working directory is not part of a module
amsmac011:GoCourse lsanmartin$ cat present_and_share.sh
go run golang.org/x/tools/cmd/present -http=:3999 -play=false
amsmac011:GoCourse lsanmartin$ present -base .
2020/07/17 21:09:11 Failed to parse templates: open templates/action.tmpl: no such file or directory
Thanks @pathcl for filling in this issue. I'll look at it.
amsmac011:GoCourse lsanmartin$ ./present_and_share.sh cannot find module providing package golang.org/x/tools/cmd/present: working directory is not part of a module amsmac011:GoCourse lsanmartin$ cat present_and_share.sh go run golang.org/x/tools/cmd/present -http=:3999 -play=false amsmac011:GoCourse lsanmartin$ present -base . 2020/07/17 21:09:11 Failed to parse templates: open templates/action.tmpl: no such file or directory
if you have executed the get and run commands, that issue should not come, incase if your GOPATH is not set properly, you can try adding a mod file to it, that is not ideally recommended but one of the options.
@pathcl is it still an issue? Probably we should update README.md with more detailed instructions. Or add a check if present tool is really installed. WDYT?
I have same issue but from different angle. I've installed present this way (go version go1.16.2 darwin/amd64):
- go get -u golang.org/x/tools/present
- go get golang.org/x/tools/cmd/present
Then when I'm stating it same error: macbookpro1:~user$ present
Couldn't find gopresent files: no required module provides package golang.org/x/tools/cmd/present: go.mod file not found in current directory or any parent directory; see 'go help modules'
By default, gopresent locates the slide template files and associated static content by looking for a "golang.org/x/tools/cmd/present" package in your Go workspaces (GOPATH).
You may use the -base flag to specify an alternate location.
@atugai I'll look at it using the same Go version. Probably something changed in the meantime with the present tool. TY for info!
To be honest this looks like a non-documented feature. Present tries to look required files locally. If I pass this as flag to mod location then it works:
present -base /Users/user/go/pkg/mod/golang.org/x/[email protected]/cmd/present
2021/04/07 15:45:05 Open your web browser and visit http://127.0.0.1:3999 2021/04/07 15:48:31 accepting connection from: 127.0.0.1:59807
I suspect this changed after mods introduced ¯_(ツ)_/¯ Anyway since this is working now - I don't have any questions here. Just for the records how I solved this.
To add it was looking for template files:
ls go/pkg/mod/golang.org/x/[email protected]/cmd/present/templates/ action.tmpl article.tmpl dir.tmpl slides.tmpl
And most important thing I made initial mistake installed only: go get -u golang.org/x/tools/present
But in fact to have this as cli tools you need to download this: go get golang.org/x/tools/cmd/present
The simplest way to fix this, in my experience, is to initialise a module where your slides are:
go mod init mytalk
and then add golang.org/x/tools/present as a dependency:
go get golang.org/x/tools/present
After that, present works out of the box, without the need to resort to the -base flag.
we can resolve this issue, as this one is fixed in the following merge request. https://github.com/RedHatOfficial/GoCourse/pull/139 Further if anyone faces any problem, we can again reopen new issue.
+1 @ashwini3326 . Thank you very much