Can not run on Go playground from VSC

My system variables are

$ echo $GOPATH $GOROOT
C:\go-work C:\Go\

A progect path:

C:\go-work\src\packtest

The project structure

packtest
    util
        util.go
    main.go

When I run from Visual Studio Code - “Run On Go Playground” I get

Upload to the Go Playground failed.
prog.go:5:2: cannot find package “packtest/util” in any of:
/usr/local/go/src/packtest/util (from $GOROOT)
/go/src/packtest/util (from $GOPATH)

The progect is in the system path, but VSC looks for files in different folders. How to fix that?

p.s. If run that in VSC from command line (not in the playground) it works

Hi. Could it be that Run On Go Playground just uploads the selected file as go playground really can’t handle multiple files? It then tries to import util on the go playground machine and can’t find it in the presented directories.

1 Like

hi, it seems it’s like that.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.