20220713
使用secureCRT链接远程服务器时,在用到vim中含有中文的情况时出现乱码,并且只要一编辑就会出现乱码
使用 https://blog.csdn.net/sinat_30603081/article/details/124821038 的方法依次对于文件的格式进行修改,但是还是无法解决,最后发现是secureCRT的session格式的设置问题
最终的解决方法
Options -> session Options -> appearance -> character encoding 修改为UTF-8后解决该问题
20220718
1、配置golong本地开发环境,修改vim的时候/etc/profile是一个只读文件,想要export几个路径。
方法:输入 w !sudo tee % 后,在输入q退出,在打开文件时,文件已经被修改
20220720
1、go环境配置链接:https://blog.csdn.net/qq_44847649/article/details/123048329
配置云服务器中的golong环境遇到的问题:
INSTALL ALL之后会出现安装失败的问题,这是因为国内墙的原因,解决方法如下:
在终端中执行如下指令,然后关闭vscode重新打开,在执行install后,安装成功!
go env -w GO111MODULE=on
go env -w GOPROXY=https://proxy.golang.com.cn,direct
2、git 安装
centos 7.0 git安装: yum install git
查看git是否安装成功:git --version
20220728
1、vscode的golang环境无法跳转的问题
借鉴于: https://www.cnblogs.com/senberhu/p/15737504.html
首先,需要安装好 go 插件,插件市场搜索go,选一个即可安装。
然后,需要安装 go 的工具包。在 vscode 中,输入快捷键:command(ctrl) + shift + p,在弹出的窗口中,输入:go:install/Update Tools,回车后,选择所有插件(勾一下全选),点击确认,进行安装(设置GOPROXY)。
接下来,在项目的 settings.json 文件中添加配置:
"go.goroot": "D:\\Go",
"go.gopath": "D:\\gopath",
//第三方库代码提示
"go.inferGopath": true,
"go.formatTool": "goreturns",
//自动完成未导入的包
"go.autocompleteUnimportedPackages": true,
"go.gocodePackageLookupMode": "go",
"go.gotoSymbol.includeImports": true,
"go.docsTool": "gogetdoc",
"go.useCodeSnippetsOnFunctionSuggest": true,
"go.useCodeSnippetsOnFunctionSuggestWithoutType": true,
"go.useLanguageServer": true,
"[go]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true,
}, // Optional: Disable snippets, as they conflict with completion ranking. "editor.snippetSuggestions": "none",
},"[go.mod]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true,
},
},"go.trace.server": "verbose",
"gopls": {
// Add parameter placeholders when completing a function.
"usePlaceholders": false,
// If true, enable additional analyses with staticcheck.
// Warning: This will significantly increase memory usage. "staticcheck": false,
},"go.languageServerFlags": [
"-remote=auto", "-logfile=auto", "-debug=:0", "-rpc.trace",
],
首选项-设置 去掉 Use Language Server
2、golang语言在使用ssh远程连接服务时,出现“golang unrecognized import path “golang.org/x/crypto””的错误
这是由于国内上网众所周知的原因,用代理的方式解决:
[root@test rttys]# export GOPROXY=https://goproxy.io
[root@test rttys]# export GO111MODULE=on
[root@test rttys]# go get
go: downloading golang.org/x/crypto v0.0.0-20200311171314-f7b00557c8c4
go: extracting golang.org/x/crypto v0.0.0-20200311171314-f7b00557c8c4
go: finding github.com/dwdcth/consoleEx v0.0.0-20180521133551-f56f6eb78b76
go: finding github.com/gorilla/websocket v1.4.1
go: finding github.com/howeyc/gopass v0.0.0-20190910152052-7cb4b85ec19c
go: finding github.com/json-iterator/go v1.1.9
go: finding github.com/kylelemons/go-gypsy v0.0.0-20160905020020-08cad365cd28
go: finding github.com/mattn/go-colorable v0.1.4
go: finding github.com/rakyll/statik v0.1.7
go: finding golang.org/x/crypto v0.0.0-20200311171314-f7b00557c8c4
go: finding github.com/rs/zerolog v1.18.0
go: finding github.com/mattn/go-isatty v0.0.8
go: finding golang.org/x/sys v0.0.0-20190412213103-97732733099d
go: finding github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421
go: finding github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742
如果没有go.mod,需要创建go.mod文件,并将以下的信息拷入到该文件中:
[root@test rttys]# cat go.mod
module github.com/zhaojh329/rttys
go 1.14
require (
github.com/dwdcth/consoleEx v0.0.0-20180521133551-f56f6eb78b76
github.com/gorilla/websocket v1.4.1
github.com/howeyc/gopass v0.0.0-20190910152052-7cb4b85ec19c
github.com/json-iterator/go v1.1.9
github.com/kylelemons/go-gypsy v0.0.0-20160905020020-08cad365cd28
github.com/mattn/go-colorable v0.1.4
github.com/rakyll/statik v0.1.7
github.com/rs/zerolog v1.18.0
golang.org/x/crypto v0.0.0-20200311171314-f7b00557c8c4
)