intellij idea15的idea2016 golang 插件插件怎么配置

12155人阅读
golang(2)
插件虽然好,但是官方的编译版总是更新很慢,所以需要自己编译,问了老外才知道怎么编译,编译方法如下:
I opened this project in IDEA Community 13 (or whatever the latest EAP is), then choose the SDK
as the program folder (C:\Program Files\JetBrains\Intellik IDEA Community Edition) and then went to Build -& Prepare for Deployment. It'll save a jar file in the location that popups up and then you can install that in an IDEA IDE.
具体的过程,我截图如下:
intellijIDEA的首页放的是稳定版,而我们要找到测试版,直接点如下链接就能下载测试版:
下载安装完成后,点击help菜单更新,如下图:
然后下载 idea的 golang插件源码:
解压到任意目录,比如c:\idea_golang
然后用idea打开这个目录,即点击菜单 File》Open
然后再设置一下环境:
分别指定:
jdk的目录(需要去java首页下载)idea的安装目录go语言的安装目录(需要去golang的首页下载)
设置完SDKs之后,还要在Modules页面重新指定一下idea的安装目录,看图:
最后可以Ctrl+Shift+F9编译试试,如果弹出的信息都是警告(warning)信息而没有错误信息(error),那就说明没问题了。
接下来就可以像老外说的那样,点击菜单:
Build -& Prepare for Deployment
会在项目目录生成一个jar文件。
这个就是编译好的插件了。
安装这个插件的方法是:
File》Settings》Plugins》Install plugin from disk
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:64266次
排名:千里之外
原创:22篇
评论:11条
(1)(1)(1)(1)(2)(3)(1)(1)(2)(8)(1)(2)(1)(1)(1)(1)(1)(1)intellij idea15的golang插件怎么配置_百度知道
intellij idea15的golang插件怎么配置
提问者采纳
装了intellj idea 15社区版和golang插件。通过命令行启动intellij,之后的使用都很正常,我只用intellj编写go。附加一点,主要是可以在命令行根据需要改变GOPATH,不用做其他配置我是win 10家庭版,运行和跑测试都是在单独的命令行
来自团队:
其他类似问题
为您推荐:
intellij的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁Setting up Intellij IDEA for your Golang project - 推酷
Setting up Intellij IDEA for your Golang project
After two full months of testing Golang plugin in Intellij IDEA, I’m happy I can say it’s sufficient and there are no real limits in using it - no more Sublimes, Atoms, LiteIDEs. If you’re not a Vim user and want to try real IDE with Golang, “go” for this. Here’re the steps to make your live easier too.
Installing Go and Golang plugin
I assume you have the Golang downloaded. If not, please download it first
In Intellij Idea go to the plugin list and browse the repository for Go plugin. You can’t miss it. After you install it, restart your IDE.
In case you’re working on the existing (imported/opened) project, check whether you have proper SDK selected. Idea probably asked you about it first time you opened it via notification, but if it’s not set correctly, some things below wouldn’t work.
Integrating Go tools
There are couple of preconditions you should meet before we proceed - mostly to avoid scenarios that something is working in the terminal and not in IDEA and vice versa:
$GOPATH is set in your environment (via ~/.profile )
$GOROOT is set in your environment (via ~/.profile )
$GOPATH/bin is in your $PATH (via ~/.profile )
If you use v1.5.x of Golang and want vendor experiment enabled, set $GO15VENDOREXPERIMENT=1 in your environment (via ~/.profile )
Now add $GOPATH into global libraries so it nicely resolves all your dependencies:
File - Settings - Languages & Frameworks - Go - Go libraries
Add resolved $GOPATH into global libraries
is a tool that automatically manages your imports - removes unused, adds unimported in case it’s resolvable and also formats your source.
In case you want to only format your code, use
In terminal:
Run go get golang.org/x/tools/cmd/goimports
In Intellij Idea:
File - Settings - Tools - File Watchers - Green plus
Fill the form
Name, Description: are up to you
Disable Immediate file synchronization*
File type: Go
Scope (skip if you’re not using Vendor experiment):
Open custom scopes dialog by clicking three-dot button right to the selectbox
Create new custom scope called “GoVendor”
Put following as a pattern: !file[your-project-name]:vendor//*
Use newly created scope as a filewatcher scope, so it doesn’t touch a vendor folder
Program: full resolved path to goimports ( $GOPATH/bin/goimports )
Arguments: -w $FilePath$
Environment variables (skip if you’re not using Vendor experiment): GO15VENDOREXPERIMENT=1
Confirm (rest can be kept with default values)
After every save, GoImports will get triggered and your code will be formated and altered as necessary.
We need to one more fix related to saving. The problem here is that if autosave was trigerred every second, your caret would move around randomly all the time when GoImports is run and you would go nuts very quickly.
*Files are being altered by external tool and IDE would move the caret around every second because of autosave -& external change -& reload cycle. Disabling autosave is mandatory to be able to work with the GoImports.
To fix it:
File - Settings - Appearance & Behavior - System settings
Edit synchronization section
Disable synchronize files on frame or editor tab activation
Enable save files on frame deactivation
Enable and put a big number in Save files automatically if application is idle for X seconds (disabling this will cause autosave being triggered again)
Disable safe write to temporary file
is a linter tool that will make you write and document your code properly. The sooner you start with it, the nicer code you’ll produce.
In terminal:
Run go /golang/lint/golint
In Intellij Idea:
Run - Edit configurations - Defaults - Go application
Before launch - Green plus - Run external tool - Green plus (just once, next time you’ll reuse if necessary)
Fill the form
Name, Description: are up to you
Group: external tools
Mark all 4 option checkboxes enabled: Synchronize files after execution, Open console, Sow console when a message is printed to stdout/stderr
Program: full resolved path to golint ( $GOPATH/bin/golint )
Parameters: empty
Working directory: $ProjectFileDir$
Unfortunately there’s no way how to stop build if GoLint has any kind of objections. It’s always returning exit code 0 - see the
Linter will now be triggered with every build in separate tab.
is a tool that tries to find logical issues in your source - e.g. checking if your Sprintf() string references the same amount of variables as you provided afterwards.
In Intellij Idea:
Run - Edit configurations - Defaults - Go application
Before launch - green plus - Go command - Type “vet”
In case go vet finds something, it will stop the build as it returns non-zero exit code.
If you already had some run/debug configurations created prior these settings, you’ll have to add “before launch” commands into those configurations too. All new configurations will be created with Go Vet automatically.
Vendor experiment
To get more information about vendor experiment in Go 1.5, visit the
. Vendoring is enabled by default since Go 1.6.
Run - Edit configurations - Defaults - Go application
Environment (three dots)
Add variable with name GO15VENDOREXPERIMENT and value 1
Conclusion
Because of the way how we set things up, all of the tools are also working from within IDE terminal which is nice. With the doc integration that IDEA provides by default ( CTRL+Q ), you now have really neat environment for developing in Go.
Intellij IDEA is also the only IDE I was able to use debugger in, which is a huge plus when you’re trying to catch a bug. The only problem I found currently is that when you kill the app, it kills debugger but binary keeps still running - you have to manually kill the process of your app.
The plugin is still in heavy development and things might change in the future (vendoring is not fully supported, interface implementations are not being recognized), but it’s on the way.
已发表评论数()
已收藏到推刊!
请填写推刊名
描述不能大于100个字符!
权限设置: 公开
仅自己可见
正文不准确
标题不准确
排版有问题
没有分页内容
图片无法显示
视频无法显示
与原文不一致intellij idea15的golang插件怎么配置_百度知道
intellij idea15的golang插件怎么配置
我有更好的答案
我是win 10家庭版,装了缉涪光皇叱郝癸酮含捆intellj idea 15社区版和golang插件,不用做其他配置。通过命令行启动intellij,主要是可以在命令行根据需要改变GOPATH,之后的使用都很正常。
附加一点,我只用intellj编写go,运行和跑测试都是在单独的命令行,没有使用intellj的内置的run和debug
其他类似问题
为您推荐:
intellij的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁

我要回帖

更多关于 intellij idea 插件 的文章

 

随机推荐