Fork of vscode-go, do some works on lower version of vscode-go to support go 1.14.
- This extension is mainly based on open source vscode-go v0.37.0-rc.1.
- Modification
- Download gopls, dlv and other tool versions for different go versions
- Enable the highlighting function
- Change the chinese agent(GOPROXY = "https://goproxy.cn,direct") before the go tool is downloaded. Fixed gobuild timeout issues
- Add Chinese translation
Welcome!
Whether you are new to Go or an experienced Go developer, we hope this
extension fits your needs and enhances your development experience.
-
Install Go 1.14 or newer if you haven't already.
-
Install the [Kylin Go extension].
-
Open any directory or workspace containing Go code to automatically activate the extension. The [Go status bar]appears in the bottom left corner of the window and displays your Go version.
-
The extension depends on
go
,gopls
,dlv
and other optional tools. If any of the dependencies are missing, the⚠️ Analysis Tools Missing
warning is displayed. Click on the warning to download dependencies.See the [tools documentation]for a complete list of tools the extension depends on.
You are ready to Go :-)
- [IntelliSense] - Results appear for symbols as you type.
- [Code navigation] - Jump to or peek at a symbol's declaration.
- [Code editing] - Support for saved snippets, formatting and code organization, and automatic organization of imports.
- [Diagnostics] - Build, vet, and lint errors shown as you type or on save.
- [debugging] - The extension can be debuggable by configuring the launch. json file. First, configure the launch. json file, set the breakpoint, and press the debugging button or key 'F5' to debug. This extension also supports debugging without configuration, after setting the breakpoint, click the debugging button or key 'F5' to debug.
(Code completion and Signature Help)
In addition to integrated editing features, the extension provides several
commands for working with Go files. You can access any of these by opening the
Command Palette (Ctrl+Shift+P
on Linux/Windows and Cmd+Shift+P
on Mac), and
then typing in the command name. See the
[full list of commands] provided by this
extension.
For better syntax highlighting, we recommend enabling
semantic highlighting
by turning on [Gopls' ui.semanticTokens
setting].
"gopls": { "ui.semanticTokens": true }
The Go extension supports both GOPATH
and Go modules modes.
Go modules are used to manage dependencies in
recent versions of Go. Modules replace the GOPATH
-based approach to specifying
which source files are used in a given build, and they are the default build
mode in go1.16+. We highly recommend Go development in module mode. If you are
working on existing projects, please consider migrating to modules.
Unlike the traditional GOPATH
mode, module mode does not require the workspace
to be located under GOPATH
nor to use a specific structure. A module is
defined by a directory tree of Go source files with a go.mod
file in the
tree's root directory.
Your project may involve one or more modules. If you are working with multiple modules or uncommon project layouts, you will need to configure your workspace by using Workspace Folders.
This project follows the Go Community Code of Conduct. If you encounter a conduct-related issue, please mail [email protected].
Fork vcode-go分支,在vcode-go的低版本分支上做一些工作来支持go 1.14。
- 该插件主要基于开源插件vscode-go的tag v0.37.0-rc.1修改。
- 主要修改:
- 针对不同go版本下载gopls、dlv等工具版本
- 开启高亮配置
- go工具下载时更换国内代理(GOPROXY = "https://goproxy.cn,direct"),修复gobuild等超时问题
- 增加本地化语言
-
请安装 Go 1.14以上版本软件包
-
安装 [Kylin Go 插件].
-
打开任何包含Go代码的目录或工作空间来自动激活扩展。Go状态栏出现在窗口的左下角,显示你的Go版本。
-
扩展依赖于
go
,gopls
,dlv
和其他可选工具。如果缺少任何依赖项,则会显示⚠️ Analysis Tools Missing
警告。单击警告可以下载依赖项。
- 代码补全-输入符号时显示结果。
- 代码导航-跳转到或窥视符号的声明。
- 代码编辑-支持保存代码片段、格式化代码,以及自动代码补全。
- 代码检查-在您键入或保存时显示检查错误。
- 代码调试-支持通过配置launch.json文件,设置断点后,点击调试按钮或者按键'F5'进行调试。本插件也支持无配置调试,设置断点后,点击调试按钮或者按键'F5'进行调试。
除了集成的编辑功能外,该扩展还提供了几个用于处理Go文件的命令。你可以通过打开命令面板(Linux/Windows上是Ctrl+Shift+P, Mac上是Cmd+Shift+P),然后输入命令名称来访问其中的任何一个。
为了获得更好的语法突出显示,我们建议通过打开Gopls的ui来启用语义突出显示。semanticTokens设置。"gopls": {"semanticTokens": true}
```
"gopls": { "ui.semanticTokens": true }
```
Go扩展支持GOPATH和Go模块模式。
在最新版本的Go中,Go模块用于管理依赖关系。模块取代了基于gathath的方法来指定在给定构建中使用哪些源文件,并且它们是go1.16+中的默认构建模式。我们强烈推荐以模块模式开发Go。如果您正在处理现有项目,请考虑迁移到模块。
与传统的GOPATH模式不同,模块模式不要求工作空间位于GOPATH下,也不需要使用特定的结构。模块是由一个包含Go源文件的目录树定义的,在树的根目录中有一个“go.mod”文件。
您的项目可能涉及一个或多个模块。如果您正在使用多个模块或不常见的项目布局,则需要使用工作区文件夹来配置您的工作区。
该项目遵循Go社区行为准则。如果您遇到与行为有关的问题,请发送邮件至[email protected]。