All Products
Search
Document Center

Alibaba Cloud SDK:Set up a Go development environment on Windows

Last Updated:Jun 04, 2026

Set up a Go development environment on Windows with Visual Studio Code (VS Code).

  1. Visit the official website of VS Code and click Download for Windows to download the installation file.

    222.png

  2. Double-click the downloaded file such as VSCodeUserSetup-x64-1.89.1.exe and use the installation wizard to install VS Code.

    Important

    In the Select Additional Tasks step, you must select Add to PATH (requires shell restart).

  3. Open VS Code. In the left sidebar, click Extensions or press Ctrl+Shift+X. Install the following extensions:

    • Go: The official Go extension. Provides code editing, intelligent completion, and debugging.

    • Code Runner: Runs code directly in the editor with a single click. Supports multiple languages including Go, Python, C++, Java, PHP, and Node.js.

    image

  4. Create a Go project.

    In the VS Code menu bar, click File > Open Folder. Create a new project folder, such as goProjects, and then select the folder.

  5. Initialize the Go module.

    In the VS Code menu bar, click Terminal > New Terminal. Run `go mod init goprojects` to initialize the module. A go.mod file is generated in the project directory to manage dependencies and versions.

    image

  6. Create a .go file. To the right of the project name, click New File..., enter a file name such as helloaliyun.go, and paste the following code:

    image

    package main
    
    import (
    	"fmt"
    )
    
    func main() {
    	fmt.Println("hello aliyun")
    }
  7. Run the code.

    • If Code Runner is installed, right-click in the editor and select Run Code.

      image

    • Run the go run command in the Terminal.

      image

    • Select the file to run, such as helloaliyun.go. In the left sidebar, click Run and Debug or press Ctrl+Shift+D, then click Run and Debug.

      image

  8. Verify the setup.

    Check the console output. If hello aliyun! appears, the Go development environment is ready.