SoFunction
Updated on 2025-03-02

Go language compiler runs from the background without the dos window operation

Order:

go build -ldflags "-H windowsgui" Compile the file.go

For example:

go build -ldflags "-H windowsgui" 

Common parameters:

-o "" If this parameter is added, the compiled output file name will be changed to

Supplement: Golang is a commonly used shortcut key, which compiles the linux program parameter settings, and does not display the DOS window commands for compiling.

Organize the shortcut keys commonly used by individuals during development:

Debugging

Step into F7

Step over F8

Run to cursor Alt + F9

Recovery Program F9

Set/cancel breakpoint Ctrl + F8

View breakpoints Ctrl + Shift + F8

Search / Replace

Search all Double Shifts

Find (current page search) Ctrl + F

Find method or variable Ctrl + Shift + Alt + F7

Find the next F3

Find the previous Shift + F3

Replace Ctrl + R

Find Ctrl + Shift + F in the path

Replace with path Ctrl + Shift + R

Editing

Parameter information (in the method call parameter) Ctrl + P

Quick Document Search Ctrl + Q

External Document Search Shift + F1

Display error description Ctrl + F1

Line Comments Ctrl + /

Block Comments Ctrl + Shift + /

Reformat the code Ctrl + Alt + L

Automatic shrink Ctrl + Alt + I

Indent/Unink select line Tab / Shift + Tab

Copy the current line Ctrl + D

Delete the current line Ctrl + Y

Start a new journey Shift + Enter

Toggle case of words in caret or selected block Ctrl + Shift + U

Select until the end of the code block/start Ctrl + Shift +] / [

Expand/collapse code block Ctrl + NumPad + / -

Expand/collapse all Ctrl + Shift + NumPad + / -

Refactoring (refactoring)

Copy file F5

Move file F6

Navigation

Back/Forward Navigation Ctrl + Alt + Arrow Keys Left/Right

Navigate to the previous editing location Ctrl + Shift + Backspace

Go to declaration Ctrl+B, Ctrl+left mouse click

Go to implementation Ctrl + Alt + B

Go to Type Declaration Ctrl + Shift + B

Go to Super Method/Super Class Ctrl + U

Go to previous/next method Alt + arrow keys Up/down

Compile and Run

Debugging Shift + F9

Run Shift + F10

Find Usage/Find Usage in File Alt + F7 / Ctrl + F7

Compile a Linux-run Golang program in Windows

// cmd set parametersSET CGO_ENABLED=0 
SET GOOS=linux 
SET GOARCH=amd64
go build 

The DOS window is not displayed when golang is executed (Using Go Version 1.4.2 or above)

go build -ldflags "-H windowsgui" 

The above is personal experience. I hope you can give you a reference and I hope you can support me more. If there are any mistakes or no complete considerations, I would like to give you advice.