GoCourse icon indicating copy to clipboard operation
GoCourse copied to clipboard

can't run present

Open pathcl opened this issue 5 years ago • 9 comments

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

pathcl avatar Jul 17 '20 19:07 pathcl

Thanks @pathcl for filling in this issue. I'll look at it.

tisnik avatar Jul 20 '20 08:07 tisnik

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.

KB-perByte avatar Sep 01 '20 19:09 KB-perByte

@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?

tisnik avatar Nov 05 '20 07:11 tisnik

I have same issue but from different angle. I've installed present this way (go version go1.16.2 darwin/amd64):

  1. go get -u golang.org/x/tools/present
  2. 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 avatar Apr 07 '21 13:04 atugai

@atugai I'll look at it using the same Go version. Probably something changed in the meantime with the present tool. TY for info!

tisnik avatar Apr 07 '21 14:04 tisnik

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.

atugai avatar Apr 07 '21 16:04 atugai

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

atugai avatar Apr 07 '21 16:04 atugai

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

atugai avatar Apr 07 '21 16:04 atugai

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.

jub0bs avatar Dec 10 '21 09:12 jub0bs

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.

ashwini3326 avatar Feb 23 '23 16:02 ashwini3326

+1 @ashwini3326 . Thank you very much

tisnik avatar Feb 23 '23 17:02 tisnik