formulahendry / formulahendry/vscode-code-runner
Does not work with Golang Modules
- Dominant language
- TypeScript
- Stars
- 2.4k
- Forks
- 351
- PR merge metrics
- No merged PRs in 30d
Description
- VS Code Version: 1.37.1
- OS Version: 10.14.6
- Code Runner Version: 0.9.14
**Describe the bug**
Fails to recognize imports when using go modules
**To Reproduce**
Steps to reproduce the behavior:
1. Initialize a go module within a non `GOPATH` or `GOROOT` directory `go mod init myplay`
2. Create two go files.
- `main.go` and
- `greeter/hello.go`
```
// main.go
package main
import (
"fmt"
"myplay/greeter"
)
func main() {
message := greeter.GreetMe("Charlie")
fmt.Println(message)
}
```
```
// greeter/hello.go
package greeter
// GreetMe Demo
func GreetMe(name string) string {
return "Hello, " + name + "!"
}
```
**Actual behavior**
```
myplay/main.go:5:2: cannot find package "myplay/greeter" in any of:
/usr/local/opt/go/libexec/src/myplay/greeter (from $GOROOT)
/Users/self/go/src/myplay/greeter (from $GOPATH)
```
**Expected behavior**
Print `Hello Charlie`
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.