GoLand

Debugger configuration in GoGland

寵の児 提交于 2020-01-15 11:41:53
问题 I want to debug my go application when I send request using curl command. Currently my request is handled by the binary I have. What I want that when I send request using curl command request should be handled by the code I have not by the binary. I did not find any documentation about it, only found this thiswhich is still unanswered. @Zoyd did you found a way to configure it? 回答1: I've made a short video of how debugging works in Gogland and how it should be configured: https://youtu.be

How can I see if the GoLand debugger is running in the program?

不问归期 提交于 2020-01-13 13:07:44
问题 In C# the executing program can detect if it's running in the debugger using: System.Diagnostics.Debugger.IsAttached Is there an equivalent in Go? I have some timeouts which I would like to be disabled while I am stepping through the code. Thanks! I am using the GoLand debugger. 回答1: As far as I know, there is no built-in way to do this in the manner you described. But you can do more or less the same using build tags to indicate that the delve debugger is running. You can pass build tags to

GOLAND Environment Vars in .env file

爱⌒轻易说出口 提交于 2020-01-05 04:27:08
问题 Could anyone say me how to export environment vars before running GoLand Run" with such command: source .env .env file: export MY_VAR="Some value" Yes I know, that I can define all vars in run config using "Environment variables", but it is too, em... bad solution, as I store all vars in bash file. 回答1: There is a plugin built for this purpose. It can import .env , .json and .yaml . https://plugins.jetbrains.com/plugin/7861-envfile 回答2: You can go to Tools | Create command line launcher...

Valid methods in being highlighted in red 'Unresolved Reference'

一曲冷凌霜 提交于 2019-12-21 11:26:12
问题 How to solve this problem? The program works. But the methods in Gogland are highlighted in red. Qt version 5.8 is added. Gogland (1.0 Preview) 1.0 EAP Build #GO-171.4694.61, built on June 27, 2017 Gogland EAP User Expiration date: September 25, 2017 JRE: 1.8.0_112-release-736-b21 amd64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Linux 4.8.0-58-generic batis@dev:~$ printenv | grep GO GOROOT=/usr/lib/go-1.8/ GOPATH=/home/batis/gocode/ package main import ( "os" "github.com/therecipe/qt

golang unexpected directory layout

送分小仙女□ 提交于 2019-12-21 05:03:13
问题 So I downloaded minio from github.com/minio/minio I want to run it from the source, I create my directory like: ~/Downloads/minio-RELEASE.2017-06-13T19-01-01Z | src | all minio directories, including vendor, like the image below I also use godep resolve other dependencies under GOPATH. Now I run it from Gogland(go IDE) It shows: GOROOT=/usr/local/Cellar/go/1.8.3/libexec GOPATH=/Users/xl/Downloads/minio-RELEASE.2017-06-13T19-01-01Z:/Users/xl/go /usr/local/Cellar/go/1.8.3/libexec/bin/go build

How do I configure goland to recognize 'mod' packages?

我是研究僧i 提交于 2019-12-21 01:28:53
问题 I am taking go1.11rc1 for a spin and the first thing I noticed is that goland does not recognize imports. The goland version announcement says: "support for Go modules out of the box (formerly known as vgo)" Anyone know how to fix this? Problem: Packages like "github.com/urfave/cli" colored red and hover text says: "Cannot resolve directory..." Imported package items like "NewApp" in "app := cli.NewApp()" colored red and hover text says: "Unresolved reference ..." Steps to reproduce: Install

How do I configure goland to recognize 'mod' packages?

主宰稳场 提交于 2019-12-21 01:28:48
问题 I am taking go1.11rc1 for a spin and the first thing I noticed is that goland does not recognize imports. The goland version announcement says: "support for Go modules out of the box (formerly known as vgo)" Anyone know how to fix this? Problem: Packages like "github.com/urfave/cli" colored red and hover text says: "Cannot resolve directory..." Imported package items like "NewApp" in "app := cli.NewApp()" colored red and hover text says: "Unresolved reference ..." Steps to reproduce: Install

How to debug go code on remote machine using Goland?

纵饮孤独 提交于 2019-12-20 03:32:22
问题 I have a go codebase on a remote machine that I'd like to be able to debug using Goland. I've been trying to figure out how to set something akin to PyCharm's remote interpreter, but I haven't been able to figure it out. The best I can find is their blog's tutorial, but it's complicated by docker containers and web applications. How do I set up Goland to remotely debug? 回答1: In that blog post, Docker containers are used to simulate a remote machine. GoLand doesn't have anything similar to

exec.command for patch command

百般思念 提交于 2019-12-13 07:49:57
问题 I am trying to patch a file using the below command patch -p0 < <file_path> My runCommand syntax is as below: func runCommand(cmd string, args ...string) error { ecmd := exec.Command(cmd, args...) ecmd.Stdout = os.Stdout ecmd.Stderr = os.Stderr ecmd.Stdin = os.Stdin err := ecmd.Run() return err } Now I am passing my patch command as below: cmd = "patch" args := []string{"-p0", "<", "/tmp/file"} err = runCommand(cmd, args...) But I am seeing the below error: patch: **** Can't find file '<' :

golang debugger stops on empty lines - why?

☆樱花仙子☆ 提交于 2019-12-12 20:23:55
问题 I'm using Goland, the IntelliJ Go debugger. I've tried doing a go run build.go clean followed by a go run build.go build , and then ./pkg/cmd/grafana-server/debug , however I still get my debugger stopping in weird places, namely, blank lines: What causes the Go debugger to break on blank lines, and how can I correct it? 回答1: Are you building the binary yourself using go run as described in the issue? If so, please switch to the IDE and use the built-in Run Configuration tools and launch a