分類:Mac

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套件

Sublime Text 小技巧

修改字型,避免Color Scheme,覆蓋預設字型造成中文亂碼

"font_face": "Courier New"

禁止索引,讓cpu不會負擔哪麼高

"index_files":false

或是指定部分檔案不索引

"index_exclude_patterns": [*.log]

指定某些檔案不在側邊欄位出現

"file_exclude_patterns": [*.log]

指定資料夾不在側邊欄位出現

"folder_exclude_patterns": ["logs"]

Mac 初體驗

必裝軟體

1.HomeBrew

套件管理軟體,類似ubuntu的apt-get

brew install bash-completion 自動補齊

2.CheatSheet

查閱快捷鍵的小幫手

3.Magnet

App視窗分邊的工具

4.iTerm2

好用的 terminal 支援快捷鍵Hide/Show

semantic history設定,下載iterm_open_with.sh

/usr/local/bin/iterm_open_with \5 \1 \2

5.AppCeaner

深度移除APP的工具

6.Sublime text

編輯器

7.更新PHP7

brew unlink php56

brew install php72