Answer the question
In order to leave comments, you need to log in
When you run a console program written in go, the Windows terminal immediately closes?
When you run a console program written in go, the Windows terminal immediately closes, please tell me how to fix this using the language itself.
Answer the question
In order to leave comments, you need to log in
Open the terminal first, your program is already in it. Don't run it in console mode.
You can try to create a runner.bat file and run through it
@echo off
your programm here
pause
As mentioned above, the program worked and closed.
There are two options:
1) put a pause console command at the end or ask the user to enter a line so that it does not immediately close
2) open cmd.exe, go to the desired folder, and open the program there - it will work and the output will be in the window, but the program itself will not close
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question