dongtanghuan1885 2017-08-27 15:35
浏览 485

在Sublime Text 3中运行Golang项目

I cannot find a suitable solution for my needs with running a Go project inside a Sublime Text 3 and seeing it's output in real-time.

If I try a build system from:

  1. GoSublime - I can use run, it even runs and stops, but there is no output, which I need. It appears only when I cancel build - it's too late.

  2. Official Golang Build from Go developers - I can build the project, and that's it. It allows to run 1 file (current) only, but I need the whole project.

    I've tried to use flags for run command and to add *.go, but then I get *.go: no such file or directory

How do I see the output in real-time in one of these solutions? I've tried to create my own build system with shell_cmd = go run *.go, but stopping the process with Cancel build is not working then. Maybe you can explain how do I stop a running Go program? My mybuild.sublime-build is similar to this:

{
    "env": {
        "GOROOT": "/path/gosrc/go",
        "GOPATH": "/path/godev"
    },
    "path": "$PATH:/path/gosrc/go/bin",
    "working_dir": "/path/godev/src/github.com/user/program",
    "cmd": "go run *.go",
    "shell": true
}

..I can run Build and see the needed output, but how do I then stop a running process?

P.S. Program is not just executing and exiting - it's a service, so I should see the output when the needed actions happens.

  • 写回答

1条回答 默认 最新

  • douzhao2047 2017-08-27 22:39
    关注

    I personally use GoSublime and go build . followed by running the app by name as a second command. Obviously this sucks in a lot of ways, but it kinda sorta works most of the time. It provides a nice fast way to check for compile errors, which is most of what I need.

    Honestly, just running in a dedicated shell is nicer in every way.

    AFAIK, there is no better Go build system available for Sublime Text (that isn't an endorsement, it sucks, just less than most).

    评论

报告相同问题?

悬赏问题

  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?