环境:

windows 10
phpstudy8.1.1.3
Vmware安装centos7.6

场景

window10里goland开发,在远程linux里运行,并debug断点调适

步骤:

  1. windows 10里安装好go环境
  2. linux里也安装好go环境
  3. goland配置ssh连接linux
  4. goland配置ssh远程执行代码

具体操作

步骤1和2略过,不会的自己百度一下

也可参考下面连接
https://www.cnblogs.com/haima/p/12057933.html

步骤3.goland配置ssh连接linux

参考下面的连接:
配置方法一样:
https://www.cnblogs.com/haima/p/13257524.html

步骤4.goland配置ssh远程执行代码

编辑运行配置:
image

选择 GO Build
image

选择 SSH...
image

配置 SSH 连接linux 和 linux里的运行代码的位置

image

配置windows 的代码位置,和工作目录
image

到此配置完成。

测试断点调适

  1. 设置断点
    image

  2. debug启动
    image

  3. 看一下linux里的进程
    image

  4. 查看代码已经自动同步到linux系统里
    image

  5. apipost请求api接口地址
    image

  6. 可以看到已经入debug断点了
    image

到此完成,