Sublime Text 開發 Golang 環境配置

Sublime Text Package 安裝

GoSublime

在margo.go 註解改用LSP gopls
 
 // &golang.Gocode{
 // // Whether or not to do gocode completion using source code
 // // instead of the pre-compiled package files.
 // // Using source is often slower but offer more up-to-date completions.
 // Source: true,

 // // show the function parameters. this can take up a lot of space
 // ShowFuncParams: true,

 // // whether or not to include Test*, Benchmark* and Example* functions in the auto-completion list
 // // gs: this replaces the `autocomplete_tests` setting
 // ProposeTests: false,

 // // whether or not builtin types and functions should be shown in the auto-completion list
 // // gs: this replaces the `autocomplete_builtins` setting
 // ProposeBuiltins: true,
 // },


 golangci-lint 啟用這些檢查

 &golang.Linter{Name: "golangci-lint", Args: []string{
 "run",

 // 2019/10/29增加
 "--enable=interfacer",
 "--enable=nakedret",
 "--enable=goconst",

 "--enable=bodyclose",
 "--enable=gocritic",
 "--enable=prealloc",
 "--enable=unconvert",
 "--enable=whitespace",
 "--enable=wsl",

 "--disable=deadcode",
 "--max-same-issues=0",
 "--fast",
 }},
LSP (gopls)

配置設定
{
    "auto_show_diagnostics_panel": "never",
    "show_diagnostics_in_view_status": false,
    "log_server": false,
	"clients":
	{
		"gopls":
		{
			"enabled": true
		}
	}
}

還需要特別安裝
LSP-gopls套件

發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *

這個網站採用 Akismet 服務減少垃圾留言。進一步瞭解 Akismet 如何處理網站訪客的留言資料