Windows&GoLang集成开发环境配置

GoLang下载安装

官方下载地址为:https://golang.google.cn/dl/,下载完成后双击启动安装,全部默认选项即可完成。

LiteIDE下载安装

LiteIDE官方地址为:https://github.com/visualfc/liteide/releases/tag/x36.2,下载后解压即可。

配置GoLang系统环境变量

配置环境变量

添加GOROOT项,值为Go的安装目录,如图所示
在这里插入图片描述
在Path中添加%GOROOT%\bin;
在这里插入图片描述

环境变量配置验证

在命令行直接输入go,如下内容展示则表示配置成功


C:\Users\Administrator>go
Go is a tool for managing Go source code.

Usage:

        go <command> [arguments]

The commands are:

        bug         start a bug report
        build       compile packages and dependencies
        clean       remove object files and cached files
        doc         show documentation for package or symbol
        env         print Go environment information
        fix         update packages to use new APIs
        fmt         gofmt (reformat) package sources
        generate    generate Go files by processing source
        get         add dependencies to current module and install them
        install     compile and install packages and dependencies
        list        list packages or modules
        mod         module maintenance
        run         compile and run Go program
        test        test packages
        tool        run specified go tool
        version     print Go version
        vet         report likely mistakes in packages

Use "go help <command>" for more information about a command.

Additional help topics:

        buildmode   build modes
        c           calling between Go and C
        cache       build and test caching
        environment environment variables
        filetype    file types
        go.mod      the go.mod file
        gopath      GOPATH environment variable
        gopath-get  legacy GOPATH go get
        goproxy     module proxy protocol
        importpath  import path syntax
        modules     modules, module versions, and more
        module-get  module-aware go get
        module-auth module authentication using go.sum
        module-private module configuration for non-public modules
        packages    package lists and patterns
        testflag    testing flags
        testfunc    testing functions

Use "go help <topic>" for more information about that topic.

配置LiteIDE

双击.exe启动LiteIDE
在这里插入图片描述
选择与自己系统匹配的环境进行配置
在这里插入图片描述
点击Edit Current Environment
在这里插入图片描述
LiteIDE将打开如下配置文件,根据自己的安装进行配置即可

# native compiler windows amd64

GOROOT=c:\go
#GOBIN=
GOARCH=amd64
GOOS=windows
CGO_ENABLED=1

PATH=c:\mingw64\bin;%GOROOT%\bin;%PATH%

LITEIDE_GDB=gdb64
LITEIDE_MAKE=mingw32-make
LITEIDE_TERM=%COMSPEC%
LITEIDE_TERMARGS=
LITEIDE_EXEC=%COMSPEC%
LITEIDE_EXECOPT=/C

配置LIteIDE的GOPATH/Module…

在这里插入图片描述
使用自定义的工作目录,也就是代码及相关文件所在目录,是我们的工程目录
在这里插入图片描述

开发环境验证

新建一个代码文件,文件后缀为.go,并写入如下代码

package main

import (
	"fmt"
)

func main() {
	fmt.Println("Hello, The world of Golang")
}


然后点击LiteIDE工具栏中的BR按钮
在这里插入图片描述
在Build Output中输出的内容及为BuildAndRun的结果

发布了162 篇原创文章 · 获赞 42 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/dawei_yang000000/article/details/103238216