0

I am playing with a few programming languages within Visual Studio Code. My initial language is Python, and then I added Go in there within their own respective folders. When I run the Go file, it tries to interpret with Python, which obviously would fail.

  1. Could I have different languages within the same project and separate them by different interpreter?
  2. How do I point one folder to run with Python, the other to run with Go?

Thanks.

3
  • 1
    Have you reviewed debugging practices and setting up configurations? github.com/golang/vscode-go/blob/master/docs/debugging.md and code.visualstudio.com/docs/languages/go Commented Jul 28, 2020 at 4:36
  • change the launch configuration in the Debug/Run sidebar or create a Go one Commented Jul 28, 2020 at 12:58
  • Thanks y'all, the debugging.md link was helpful. I figured out the issue. I had to install the latest GO package, and then modify the launch.json file to include GO type. Commented Jul 30, 2020 at 4:10

1 Answer 1

2

I've gotten it to work. The Configuration settings control what you are building. It is set within the launch.json file, and you can have different languages with the same project and run them in different interpreter/compiler.

This is what I have in my launch.json.

"version": "0.2.0", "configurations": [ { "name": "GO: Launch", "type": "go", "request": "launch", "mode": "auto", "program": "${fileDirname}", "env": {}, "args": [] }, { "name": "Python: Current File", "type": "python", "request": "launch", "program": "${file}", "console": "integratedTerminal" } ] 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.