When I am editing a .go source file like that PROJECT_DIR/internal/moduleABC/moduleABC.go and press Start Debugging I get this message "Failed to launch: could not launch process: not an executable file" and then I need to navigate to any of the files in PROJECT_DIR and start debugging again.
Very annoying, maybe someone know a way to fix this.
Thx
Hopefully there is a solution not just for one single module but for all of them.
2
Answers
I edited launch.json and replaced
with
and now the main app is launched even if I am in an internal module folder
full launch.json file
It seems like you’re encountering an issue with launching a Golang application from VS Code, especially when working with internal modules. To address this problem, you can follow these steps:
Ensure that you have specified the correct entry point for your Go application in the launch configuration. Open your .vscode/launch.json file, and make sure that the "program" field points to the correct main file or package. For example:
Then, set the "useApiV1" field to ‘false‘ in your
launch.json:
Make sure your project is using Go modules. If not, initialize modules in your project:
Ensure that your go.mod file has the correct module path.
Update VS Code and Go Extension:
Ensure that both VS Code and the Go extension are up to date. Extension updates often include bug fixes and improvements.
Reload Window:
After making changes to your configuration, try reloading the VS Code window. You can do this by clicking on the circular arrow icon in the bottom-left corner of the window.
If the issue persists, please provide more details about your project structure and the content of your launch.json file, so I can offer more targeted assistance.