formulahendry / formulahendry/vscode-code-runner

[Bug] Cannot recognize multiple files using `package main` in GO

Open
#1,097 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
2.4k
Forks
351
PR merge metrics
No merged PRs in 30d

Description

- VS Code Version: 1.85.2
- OS Version: Windows 11/WSL2 running Ubuntu 22.04
- Code Runner Version: 0.12.1
- Go Version: 1.21.6

**Describe the bug**
- I have a file named ```main.go``` and one ```functions.go``` in the root of my project, both use ```package main```
- If use a function from ```functions.go``` in the ```main.go``` file, code runner cannot find the said function.

Here's the function from ```functions.go```
```
package main

func PrintData() {
print("I'm printing data...")
}
```
Here's the ```main.go```
```
package main

func main() {
PrintData()
}
```

**To Reproduce**
Steps to reproduce the behavior:

1. Make those two files.
3. Start Code Runner.

**Actual behavior**
print in output:
```
# command-line-arguments
./main.go:4:2: undefined: PrintData
[Done] exited with code=1 in 0.193 seconds
```
**Expected behavior**
print in output:
```
I'm printing data...
[Done] exited with code=0 in 0.136 seconds
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.