Skip to main content

Create from Goland

Overview

Having completed the Golang installation, we can formally enter golang for development, and the two currently mainstream editors are Goland VSCode, which will describe how to create a golang project using Golan.

Goland download please refer to Goland Web Site.

:::Note a reminder The Goland version of the current document presentation is GoLand 2022.1.4, this may be different if your Goland version does not match. :::

Create project

Open Goland, click New Project, select Go, fill in the project name, click Create.

create from goland
create from goland

New main.go

Right-click on helloworld to select New, choose Go File, enter file name mainto enter.

create from goland
create from goland

Enter the following code in main.go:

package main

import "fmt"

func main() {
fmt.Println("hello world!")
}

create from goland

Run program

In Golin, there are several ways to start the program:

  1. Right click on main.go file, select Run go build main.go.
create from goland
create from goland
  1. In the main.go file content panel, the fifth line code was found func main() on the left triangle, click running.
create from goland
create from goland
  1. Right-click on main.go file, select Open In, then select Terminalto open the terminal, and then enter the following instructions to run.

    $ go run main.go
    create from goland
    create from goland