gophernotes: Not working in module mode

I am trying to run github.com/kortschak/graphprac on my local machine. I always run with module mode on, Go version 1.13.

When I try to run the first cell of the notebook at that repo I get a failure that the build with buildmode=plugin failed. When I execute this in a terminal to investigate I see that it’s because the go tool expects the go.mod file to exist and bails otherwise. Creating a go mod file in that directory allows the build to complete and also allows the cell to execute on the notebook.

Perhaps the go.mod from imported packages’ modules could be placed in the gomacro build paths.

At the very least, it should be noted that it might be necessary to invoke the server with GO111MODULE=off jupyter notebook.

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Reactions: 1
  • Comments: 27 (24 by maintainers)

Most upvoted comments

I added modules support to gomacro - i.e. import is now module aware. ASAP I will update also gophernotes to use the latest gomacro.

There should be an open issue that, among other things, proposes to implement import "." to load the Go package in the current directory. Unluckily I cannot find it anymore.

Feel free to open a new issue on this topic. If you can explain in detail the behavior you expect, even better 😃

Gophernotes should ignore the contents of current directory when importing packages: the import machinery is executed in a newly created directory `$GOPATH/src/gomacro.imports/PACKAGE/FULL/PATH’

Coming to Go from Python background, I used to do a lot of my development by writing Python code in .py files (even packages) and importing it directly in the notebook for testing how it works and fooling around.

In some regards you could say that Jupyter Notebook was my IDE. I hoped that Gophernotes could serve the same purpose for Go. Wonder if worth opening another issue for it?