当前位置:网站首页>Goland 调试go使用-大白记录
Goland 调试go使用-大白记录
2022-04-23 07:23:00 【mygugu】
前提环境检验:
goland安装成功;
go环境变量已配置,验证:
cmd----输入go version可显示版本信息,如下:
查看go 环境信息,通过命令go env实现,如下:主要关注下GOPATH
至此,环境完成!
Bug修复:
- git clone代码后,goland打开报错
GoLand:Cannot resolve symbol
以及sync dependencies ofxxx时也报错,但是运行官方示例代码就可以正常。
后来发现是GOPATH设置问题,修改如下:
setting---Go--GoPath,将Global Path 和Project GOPATH处都添加上自己设置的GOPATH路径。如上图go env 所示。再重新点击sync dependencies of xxx自动安装需要的包就可以了。
若在go build时出现类似
go: could not create module cache: mkdir C:\Program Files\Go\bin\pkg: Access is denied.
也是因为代码没有放在GOPATH指定目录下,把代码放到GOPATH目录下,再go build就成功了。
补充:
GOROOT和GOPATH区别:
GOROOT:即go安装路径,一般无大碍。
GOPATH存的是项目代码,是开发时的工作目录。
此外GOPATH可设置多个目录:
Windows下:中间用“;”隔开
GOPATH=C:/path1;C:/path2;
Linux下:中间用“:”分隔
GOPATH="/xxx/path1:/xxx/path2"
注意:
go get 时默认安装到第一个GOPATH路径
go build时,有时会报同一种类型或方法不匹配,由于多个是GOPATH路径顺序不对导致的,调换一下顺序即可解决
goland连接远程服务器:
如下图:settings---Tools---SSH Configurations(有教程说Deployment,但我没找到)
一开始没有连接信息,点击“+”添加即可,写上自己远程服务器用户名,IP,密码,端口号,可以Test connection测试下。
(2)Terminal端连接远程服务器,直接ssh 用户名@服务器IP即可,输入密码,就行了。
版权声明
本文为[mygugu]所创,转载请带上原文链接,感谢
https://blog.csdn.net/mygugu/article/details/124321354
边栏推荐
- Find the largest of 3 strings (no more than 20 characters per string).
- 在MATLAB中快速画圆(给出圆心坐标和半径就能直接画的那种)
- Ubuntu安装Mysql并查询平均成绩
- [Effective Go 中文翻译]函数篇
- Green apple film and television system source code film and television aggregation film and television navigation film and television on demand website source code
- 微信小程序 catchtap=“toDetail“ 事件问题
- [Effective Go 中文翻译] 第一篇
- 刨析——浏览器如何工作
- Interesting JS code
- [go]常见的并发模型[泛型版]
猜你喜欢
随机推荐
社区团购小程序源码+界面diy+附近团长+供应商+拼团+菜谱+秒杀+预售+配送+直播
扎心了!一女子发朋友圈羡慕别人按时发工资被开除,连点赞的同事也一同被开除了...
Find the largest of 3 strings (no more than 20 characters per string).
一篇文章看懂变量提升(hoisting)
Situational leaders - Chapter 7, solving performance problems
谈谈那些基础但不简单的股票数据
Interesting JS code
Draw a circle quickly in MATLAB (the one that can be drawn directly given the coordinates and radius of the center of the circle)
There are some problems when using numeric type to query string type fields in MySQL
Comparison of indoor positioning methods of several intelligent robots
An article understands variable lifting
MySQL数据库中delete、truncate、drop原理详解
Install MySQL for Ubuntu and query the average score
Jetson Xavier NX (3) bazel mediapipe installation
A simple theme of Typecho with beautiful appearance_ Scarfskin source code download
[learning] audio and video development from scratch (9) -- nuplayer
ansible自动化运维详解(一)ansible的安装部署、参数使用、清单管理、配置文件参数及用户级ansible操作环境构建
thinkphp6+jwt 实现登录验证
[Effective Go 中文翻译]函数篇
Compiler des questions de principe - avec des réponses