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

x/tools/cmd/present: support play snippets in module mode #35666

Open
eliasnaur opened this issue Nov 18, 2019 · 4 comments
Open

x/tools/cmd/present: support play snippets in module mode #35666

eliasnaur opened this issue Nov 18, 2019 · 4 comments

Comments

@eliasnaur
Copy link
Contributor

@eliasnaur eliasnaur commented Nov 18, 2019

What version of Go are you using (go version)?

$ go version
go version devel +9325bec899 Wed Nov 13 11:59:24 2019 +0100 darwin/amd64

Does this issue reproduce with the latest release?

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/elias/Library/Caches/go-build"
GOENV="/Users/elias/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/elias/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/Users/elias/go-tip"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/Users/elias/go-tip/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/elias/proj/gophercon-2019-talk/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/_7/lnt35k555hl2bs7fjygkhgx00000gp/T/go-build183530635=/tmp/go-build -gno-record-gcc-switches -fno-common"
GOROOT/bin/go version: go version devel +9325bec899 Wed Nov 13 11:59:24 2019 +0100 darwin/amd64
GOROOT/bin/go tool compile -V: compile version devel +9325bec899 Wed Nov 13 11:59:24 2019 +0100
uname -v: Darwin Kernel Version 18.7.0: Sat Oct 12 00:02:19 PDT 2019; root:xnu-4903.278.12~1/RELEASE_X86_64
ProductName:	Mac OS X
ProductVersion:	10.14.6
BuildVersion:	18G1012
lldb --version: lldb-1100.0.28.19
Apple Swift version 5.1 (swiftlang-1100.0.270.13 clang-1100.0.33.7)

What did you do?

$ git clone https://github.com/eliasnaur/gophercon-2019-talk
$ cd gophercon-2019-talk
$ GO111MODULE=on present

Then, I opened http://127.0.0.1:3999/gophercon-2019.slide#7 in a browser and pressed "run".

What did you expect to see?

The program running locally.

What did you see instead?

compile1.go:7:5: cannot find module providing package gioui.org/app: working directory is not part of a module

Program exited: exit status 1

present used to work with GO111MODULE=on. I believe the fix for #32027 broke it.

@gopherbot gopherbot added this to the Unreleased milestone Nov 18, 2019
@gopherbot gopherbot added the Tools label Nov 18, 2019
@eliasnaur eliasnaur changed the title x/tools/cmd/present: support GO111MODULE=on x/tools/cmd/present: support play snippets in module mode Nov 18, 2019
@mvdan
Copy link
Member

@mvdan mvdan commented Nov 18, 2019

I assume you've considered running present inside a module, even if it's a temporary one?

@eliasnaur
Copy link
Contributor Author

@eliasnaur eliasnaur commented Nov 18, 2019

github.com/eliasnaur/gophercon-2019-talk is a module: https://github.com/eliasnaur/gophercon-2019-talk/blob/master/go.mod and I run present from there.

@mvdan
Copy link
Member

@mvdan mvdan commented Nov 18, 2019

Oh, my bad for missing that detail.

@dmitshur
Copy link
Member

@dmitshur dmitshur commented Nov 18, 2019

To clarify, since you're running GO111MODULE=on present without any flags, this issue is about the local play execution mode (rather than using play.golang.org), without using Native Client (which we'll need to remove or deal with otherwise soon, made #35675 for it). To make it more explicit:

GO111MODULE=on present -use_playground=false -nacl=false

From looking at it briefly, I suspect the problem is that the snippet is being built in a temporary directory:

https://github.com/golang/tools/blob/5a76f03bc7c327212912ed6b2a76a10d7f39b224/playground/socket/socket.go#L358

Which means it doesn't use the same module where present may be running in. We should figure out what behavior we want instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.