GoLand

Go MSSQL Connection

别来无恙 提交于 2019-12-11 14:09:45
问题 How do I provide an MSSQL connection? It says it's always connected with the code. Even if the information is incorrect, it does not give errors. package main import ( "database/sql" "fmt" _ "github.com/denisenkom/go-mssqldb" "log" ) var server = "DESKTOP\\SQLEXPRESS" var port = 1433 var user = "loginx" var password = "1" var database = "test" var db *sql.DB func main() { var err error connString := fmt.Sprintf("server=%s;user id=%s;password=%s;port=%d;database=%s;", server, user, password,

IDEA必备插件系列-Ignore(版本管理文件过滤)

馋奶兔 提交于 2019-12-11 11:22:39
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 项目源码地址: https://github.com/JetBrains/idea-gitignore 插件介绍地址: https://plugins.jetbrains.com/plugin/7495--ignore/ 在线安装 通过 Settings -> Plugins -> Marketplace 进入插件市场选择并下载安装,完成后重启就生效了。 离线安装 如果 读者网络因不可抗力存在异常,可以通过 关注公众号 【 极客收藏夹 】回复消息【 34 】 获取安装包, 通过 Settings > Plugins > Install Plugin from 离线安装(如果安装时提示不兼容,请先更新 IDE 到最新版后再试) 使用 在项目除 右键新建,依次选择 New > .Ignore file > .gitignore file(Git) 进入语言选择页 在语言选择页选择想要的语言或框架过滤项后点击 Generate 生成,就会将过滤项添加到 .gitignore 文件底部了 兼容编辑器 IntelliJ IDEA, PhpStorm, WebStorm, PyCharm, RubyMine, AppCode, CLion, Goland, Datalore, DataGrip, Rider,

Invoking GAE/Go Local Development Server on Gogland

不想你离开。 提交于 2019-12-08 06:03:44
问题 How can I invoke GAE/Go local development server on Gogland? In Run/Debug Configuration window, I have the warning "Go SDK is not specified", but I can't find how I can set Go SDK. Even then I pressed OK, and invoked with Run -> Run 'Unnamed', I got this error. "C:\Program Files (x86)\JetBrains\Gogland 171.3780.106\bin\runnerw.exe" C:/Go\bin\go.exe serve C:/path/to/app.yaml go: unknown subcommand "serve" Run 'go help' for usage. Process finished with exit code 2 How can I fix? 回答1: The reason

How to disable removing unused imports?

我是研究僧i 提交于 2019-12-08 02:19:56
问题 I use goimports to automatically reformat my code and make it clean and also keep import in order. But sometimes it works in an incomfortable way together with IDE autosave. Like in this scenario: I want to add new package to my code. Then I install it with dep ensure and refresh my IDE cache. I can comfortably use the package with IDE autocomplete and navigation. What happens with goimports and IDE? I add new package In order to run dep ensure I have to save a file goimports finds unused

Go 的 IDE Goland 性能优化

江枫思渺然 提交于 2019-12-07 07:46:30
最近在使用 Goland 写代码的时候,感觉 Goland 明显有点卡,快捷键呼出 Package structure 经常半天才响应。 这这这……这不应该是我这 i7-7700 + 32G 内存 + 256G SSD 黑苹果该有的状态,一定是幻觉。 但是每天都卡好多次,明显不是幻觉。 我推测可能是 GOPATH 下的包太多了,而 Goland 每次都会根据 GOPATH 建索引,这么多的文件,肯定慢。 我记得 Goland 有一个配置 GOPATH 路径的地方,想着配置一个空的 GOPATH 这样就不需要索引那么文件了(项目用的 vendor 下的 package,所以不会有影响),但是在配置 Goland 的 GOPATH 的忽然注意到这么一个选项。 不勾选这个 Goland 就不会把 GOPATH 下的 package 创建索引了。 测试了下 果然,没有对 GOPATH 创建索引,而且一点也不卡了。 更多架构、PHP、GO相关踩坑实践技巧请关注我的公众号:PHP架构师 来源: oschina 链接: https://my.oschina.net/u/222608/blog/2353764

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

做~自己de王妃 提交于 2019-12-06 15:42:12
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. Martin Tournoij 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 dlv with the --build-flags argument. This is basically the same technique as I described in

五个goland进行go开发的小技巧

跟風遠走 提交于 2019-12-06 15:16:58
1. 实现interface 比如我想为下面的结构体实现共识interface type MyConensus struct { } 通过右键generate->implement methods->搜索engine 一键生成下面代码: type MyConensus struct { info string } func (m *MyConensus) Author(header *types.Header) (common.Address, error) { panic("implement me") } func (m *MyConensus) VerifyHeader(chain ChainReader, header *types.Header, seal bool) error { panic("implement me") } func (m *MyConensus) VerifyHeaders(chain ChainReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error) { panic("implement me") } func (m *MyConensus) VerifyUncles(chain ChainReader, block *types.Block)

五个goland进行go开发的小技巧

 ̄綄美尐妖づ 提交于 2019-12-06 15:08:32
1. 实现interface 比如我想为下面的结构体实现共识interface type MyConensus struct { } 通过右键generate->implement methods->搜索engine 一键生成下面代码: type MyConensus struct { info string } func (m *MyConensus) Author(header *types.Header) (common.Address, error) { panic("implement me") } func (m *MyConensus) VerifyHeader(chain ChainReader, header *types.Header, seal bool) error { panic("implement me") } func (m *MyConensus) VerifyHeaders(chain ChainReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error) { panic("implement me") } func (m *MyConensus) VerifyUncles(chain ChainReader, block *types.Block)

五个goland进行go开发的小技巧

夙愿已清 提交于 2019-12-06 15:00:32
1. 实现interface 比如我想为下面的结构体实现共识interface type MyConensus struct { } 通过右键generate->implement methods->搜索engine 一键生成下面代码: type MyConensus struct { info string } func (m *MyConensus) Author(header *types.Header) (common.Address, error) { panic("implement me") } func (m *MyConensus) VerifyHeader(chain ChainReader, header *types.Header, seal bool) error { panic("implement me") } func (m *MyConensus) VerifyHeaders(chain ChainReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error) { panic("implement me") } func (m *MyConensus) VerifyUncles(chain ChainReader, block *types.Block)

How to disable removing unused imports?

一曲冷凌霜 提交于 2019-12-06 11:17:06
I use goimports to automatically reformat my code and make it clean and also keep import in order. But sometimes it works in an incomfortable way together with IDE autosave. Like in this scenario: I want to add new package to my code. Then I install it with dep ensure and refresh my IDE cache. I can comfortably use the package with IDE autocomplete and navigation. What happens with goimports and IDE? I add new package In order to run dep ensure I have to save a file goimports finds unused package and removes it from imports. Not good. Workaround: A. Add new package manually with dep ensure