Golang Getting Started - The Basics

It tells the story of Golang installed on a blog, due to the reasons specified Csdn Go's IDE "Goland" cracked version can not publish blog, learning we can also have legal copies in a treasure, very cheap! !

We entered, simple entry "Hello World!"

First, create a project

First, select the file in Goland -> New-> Project .... to create a new project

Create a new project

 Select an item stored path

Select storage path

Second, run, debug configuration

After each time you create the project, we need to Goland some configuration in the upper right IDE click "Add Configuration"

Click Add Configuration

In the pop-up window, click on the "+" and select "Go Build" in the drop-down menu

Click Go Build

We need to set appears after clicking to select the Run Kind Directory

The figure above the following points should be noted:

  • Name: the name of the configuration information for the article, can be customized, also possible to use the system default value;
  • Run kind: It should be set to "Directory";
  • Directory: used to set the directory where the main package, can not be empty;
  • Output directory: used to set the storage directory to generate the compiled executable file can be empty, empty default is not an executable file;
  • Working directory: the directory is used to set the running program, may be the same "Directory" is set, but can not be empty.

Tip: In addition to the things mentioned above, the default value of the remaining configuration items using the system, without modification.

Third, create a file write code to run

Once configured, creating a good right-click on the folder and select New -> Go File, there will be a pop, fill and select Empty file Enter the file name!

Write simple code in the file after the new hello.go

Click on the top right of the green execute button, compiled execution

The following pop-up window appears Hello World, is successful, we can encode a happy ~

Published 55 original articles · won praise 215 · Views 100,000 +

Guess you like

Origin blog.csdn.net/qq_34284638/article/details/104798433