go语言集成极光 golang集成开发环境

Go语言的开源项目1.Docker项目
网址为。
介绍:Docker是一种操作系统层面的虚拟化技术,可以在操作系统和应用程序之间进行隔离,也可以称之为容器 。Docker可以在一台物理服务器上快速运行一个或多个实例 。例如,启动一个Cent OS操作系统,并在其内部命令行执行指令后结束,整个过程就像自己在操作系统一样高效 。
2.golang项目
网址为。
介绍:Go语言的早期源码使用C语言和汇编语言写成 。从Go 1.5版本自举后,完全使用Go语言自身进行编写 。Go语言的源码对了解Go语言的底层调度有极大的参考意义 , 建议希望对Go语言有深入了解的读者读一读 。
3.Kubernetes项目
网址为。
介绍:Google公司开发的构建于Docker之上的容器调度服务,用户可以通过Kubernetes集群进行云端容器集群管理 。
4.etcd项目
网址为。
介绍:一款分布式、可靠的KV存储系统,可以快速进行云配置 。
5.beego项目
网址为。
介绍:beego是一个类似Python的Tornado框架 , 采用了RESTFul的设计思路 , 使用Go语言编写的一个极轻量级、高可伸缩性和高性能的Web应用框架 。
6.martini项目
网址为。
介绍:一款快速构建模块化的Web应用的Web框架 。
7.codis项目
网址为Labs/codis 。
介绍:国产的优秀分布式Redis解决方案 。
8.delve项目
网址为。
介绍:Go语言强大的调试器,被很多集成环境和编辑器整合 。
如何配置go语言集成开发环境 vim1、编译vimgdb
下载vimgdb73和vim73
mkdir -p ./tmp
cd tmp
tar zxvf ../vim-7.3.tar.gz
unzip ../vimgdb-for-vim7.3-master.zip
mv vimgdb-for-vim7.3-master vimgdb-for-vim7.3
patch -p0vimgdb-for-vim7.3/vim73.patch
cd vim73
安装依赖
sudo apt-get install build-essential
sudo apt-get build-dep vim-gtk
sudo apt-get install libncurses5-dev
安装
// 这里直接执行make的操作
make
sudo make install
安装vimgdb runtime
cd ../vimgdb-for-vim7.3
cp vimgdb_runtime~/.vim/bundle
打开vim
:helptags ~/.vim/bundle/vimgdb_runtime/doc " 生成doc文件
添加配置.vimrc
" vimgdb插件
run macros/gdb_mappings.vim
在vim中执行gdb时go语言集成极光,报 “Unable to read from GDB pseudo tty” 的错误go语言集成极光,因为没有安装 gdb ,所以安装gdb
sudo apt-get install gdb
2、安装vundle
set up vundle
$ git clone~/.vim/bundle/vundle
Configure Plugins
在.vimrc文件的开头添加下面的内容,有些不是必须的,可以注掉
set nocompatible" be iMproved, required
filetype off" required
" set the runtime path to include Vundle and initialize
set rtp =~/.vim/bundle/vundle/
call vundle#rc()
" alternatively, pass a path where Vundle should install plugins
"let path = '~/some/path/here'
"call vundle#rc(path)
" let Vundle manage Vundle, required
Plugin 'gmarik/vundle'
" The following are examples of different formats supported.
" Keep Plugin commands between here and filetype plugin indent on.
" scripts on GitHub repos
Plugin 'tpope/vim-fugitive'
Plugin 'Lokaltog/vim-easymotion'
Plugin 'tpope/vim-rails.git'
" The sparkup vim script is in a subdirectory of this repo called vim.
" Pass the path to set the runtimepath properly.
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
" scripts from
Plugin 'L9'
Plugin 'FuzzyFinder'
" scripts not on GitHub
Plugin 'git://git.wincent.com/command-t.git'
" git repos on your local machine (i.e. when working on your own plugin)
Plugin ''
" ...
filetype plugin indent on" required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" : PluginList- list configured plugins
" : PluginInstall(!)- install (update) plugins
" : PluginSearch(!) foo - search (or refresh cache first) for foo
" : PluginClean(!)- confirm (or auto-approve) removal of unused plugins
"
" see :h vundle for more details or wiki for FAQ
" NOTE: comments after Plugin commands are not allowed.
" Put your stuff after this line
Install Plugins
Launch vim and run
: PluginInstall
vimPluginInstallqall
3、官方vim-lang插件
Config vim file .vimrc,Add content bellow in bottom of the file
" 官方的插件
" Some Linux distributions set filetype in /etc/vimrc.
" Clear filetype flags before changing runtimepath to force Vim to
"reload them.
filetype off
filetype plugin indent off
set runtimepath =$GOROOT/misc/vim
filetype plugin indent on
syntax on
autocmd FileType go autocmd BufWritePreFmt
4、代码补全的插件gocode
配置go的环境变量,比如我的配置,GOPATH变量是必须要配置的,PATH中必须把GOPATH的bin也添加进去,否则没有自动提示 , 会提示找不到模式
export GOROOT=/usr/local/go
export GOPATH=/data/app/gopath
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
Set up gocode
Then you need to get the appropriate version of the gocode, for 6g/8g/5g compiler you can do this:
go get -u github.com/nsf/gocode (-u flag for "update")
Configure vim in .vimrc file
Plugin 'nsf/gocode', {'rtp': 'vim/'}
Install Plugins
Launch vim and run
: PluginInstall
vimPluginInstallqall
写一个helloword程序,输入fmt后按C-xC-o如果能看到函数的声明展示出来 , 说明安装是正确的 。
4、代码跳转提示godef
Set up godef
go get -v code.google.com/p/rog-go/exp/cmd/godef
go install -v code.google.com/p/rog-go/exp/cmd/godef
git clone~/.vim/bundle/vim-godef
Configure vim in .vimrc file
Bundle 'dgryski/vim-godef'
Install Plugins
Launch vim and run
: PluginInstall
vimPluginInstallqall
5、代码结构提示gotags
Set up gotags
go get -u github.com/jstemmer/gotags
Put the following configuration in your vimrc:
Bundle 'majutsushi/tagbar'
nmap:TagbarToggle
let g:tagbar_type_go = {
\ 'ctagstype' : 'go',
\ 'kinds': [
\ 'p:package',
\ 'i:imports:1',
\ 'c:constants',
\ 'v:variables',
\ 't:types',
\ 'n:interfaces',
\ 'w:fields',
\ 'e:embedded',
\ 'm:methods',
\ 'r:constructor',
\ 'f:functions'
\ ],
\ 'sro' : '.',
\ 'kind2scope' : {
\ 't' : 'ctype',
\ 'n' : 'ntype'
\ },
\ 'scope2kind' : {
\ 'ctype' : 't',
\ 'ntype' : 'n'
\ },
\ 'ctagsbin': 'gotags',
\ 'ctagsargs' : '-sort -silent'
\ }
命令模式下按在右边就会显示当前文件下的函数名,结构体名等等 , 光标放到相应的tag上,按回车可以快速跳到程序中的相应位置 。
再次按会关闭tag窗口 。
PS:本地的.vimrc的配置
" 插件管理器 vundle
set nocompatible" be iMproved, required
filetype off" required
" set the runtime path to include Vundle and initialize
set rtp =~/.vim/bundle/vundle/
call vundle#rc()
" alternatively, pass a path where Vundle should install plugins
"let path = '~/some/path/here'
"call vundle#rc(path)
" let Vundle manage Vundle, required
Plugin 'gmarik/vundle'
" The following are examples of different formats supported.
" Keep Plugin commands between here and filetype plugin indent on.
" scripts on GitHub repos
" Plugin 'tpope/vim-fugitive'
" Plugin 'Lokaltog/vim-easymotion'
" Plugin 'tpope/vim-rails.git'
" The sparkup vim script is in a subdirectory of this repo called vim.
" Pass the path to set the runtimepath properly.
" Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
" scripts from
" Plugin 'L9'
" Plugin 'FuzzyFinder'
" scripts not on GitHub
" Plugin 'git://git.wincent.com/command-t.git'
" git repos on your local machine (i.e. when working on your own plugin)
" Plugin ''
" ...
"
filetype plugin indent on" required
" To ignore plugin indent changes, instead use:
" filetype plugin on
"
" Brief help
" : PluginList- list configured plugins
" : PluginInstall(!) - install (update) plugins
" : PluginSearch(!) foo - search (or refresh cache first) for foo
" : PluginClean(!)- confirm (or auto-approve) removal of unused plugins
"
" see :h vundle for more details or wiki for FAQ
" NOTE: comments after Plugin commands are not allowed.
" Put your stuff after this line
syntax on
" ********************************************************************
" 这里省略go语言集成极光了其它不相关的插件
" vimgdb插件
run macros/gdb_mappings.vim
" 官方的插件
" Some Linux distributions set filetype in /etc/vimrc.
" Clear filetype flags before changing runtimepath to force Vim to
"reload them.
filetype off
filetype plugin indent off
set runtimepath =$GOROOT/misc/vim
filetype plugin indent on
syntax on
autocmd FileType go autocmd BufWritePre buffer Fmt
" 代码补全的插件
Bundle 'Blackrush/vim-gocode'
" 代码跳转提示
Bundle 'dgryski/vim-godef'
" 代码结构提示
Bundle 'majutsushi/tagbar'
nmap F8 :TagbarToggleCR
let g:tagbar_type_go = {
\ 'ctagstype' : 'go',
\ 'kinds': [
\ 'p:package',
\ 'i:imports:1',
\ 'c:constants',
\ 'v:variables',
\ 't:types',
\ 'n:interfaces',
\ 'w:fields',
\ 'e:embedded',
\ 'm:methods',
\ 'r:constructor',
\ 'f:functions'
\ ],
\ 'sro' : '.',
\ 'kind2scope' : {
\ 't' : 'ctype',
\ 'n' : 'ntype'
\ },
\ 'scope2kind' : {
\ 'ctype' : 't',
\ 'ntype' : 'n'
\ },
\ 'ctagsbin': 'gotags',
\ 'ctagsargs' : '-sort -silent'
\ }
Go语言的支持平台 LiteIDE是一款专门为Go语言开发的跨平台轻量级集成开发环境(IDE),由QT编写 。
LiteIDE主要特点:支持主流操作系统
Windows
Linux
MacOS XGo编译环境管理和切换
管理和切换多个Go编译环境
支持Go语言交叉编译与Go标准一致的项目管理方式
基于GOPATH的包浏览器
基于GOPATH的编译系统
基于GOPATH的Api文档检索Go语言的编辑支持
类浏览器和大纲显示
Gocode(代码自动完成工具)的完美支持
Go语言文档查看和Api快速检索
代码表达式信息显示F1
源代码定义跳转支持F2
Gdb断点和调试支持
gofmt自动格式化支持其他特征
支持多国语言界面显示
完全插件体系结构
支持编辑器配色方案
基于Kate的语法显示支持
基于全文的单词自动完成
支持键盘快捷键绑定方案
Markdown文档编辑支持
实时预览和同步显示
自定义CSS显示
可导出HTML和PDF文档
批量转换/合并为HTML/PDF文档Sublime Text 2(以下简称Sublime)GoSublimegocodeMarGo的组合 。
其优点有:自动化提示代码 。保存的时候自动格式化代码,让您编写的代码更加美观,符合Go的标准 。支持项目管理支持语法高亮熟悉Java的读者应该对于idea不陌生,idea是通过一个插件来支持go语言的高亮语法,代码提示和重构实现 。
go语言框架gin之集成swagger1.先安装Go对应的开源Swagger相关的库
go get github.com/swaggo/swag/cmd/swag
go get github.com/swaggo/gin-swagger
【go语言集成极光 golang集成开发环境】 go get github.com/swaggo/files
go get github.com/alecthomas/template
2.验证是否安装成功:swag -v
3.针对接口写入注解
// @Summary 获取多个标签
// @Tags 标签
// @Producejson
// @Param name query string false "标签名称" maxlength(100)
// @Param state query int false "状态" Enums(0, 1) default(1)
// @Param page query int false "页码"
// @Param page_size query int false "每页数量"
// @Success 200 {object} model.TagSwagger "成功"
// @Failure 400 {object} errcode.Error "请求错误"
// @Failure 500 {object} errcode.Error "内部错误"
// @Router /api/v1/tags [get]
func (t Tag) List(c *gin.Context) {
}
// @Summary 新增标签
// @Tags 标签
// @Producejson
// @Param name body string true "标签名称" minlength(3) maxlength(100)
// @Param state body int false "状态" Enums(0, 1) default(1)
// @Param created_by body string false "创建者" minlength(3) maxlength(100)
// @Success 200 {object} model.Tag "成功"
// @Failure 400 {object} errcode.Error "请求错误"
// @Failure 500 {object} errcode.Error "内部错误"
// @Router /api/v1/tags [post]
func (t Tag) Create(c *gin.Context) {
}
// @Summary 更新标签
// @Tags 标签
// @Producejson
// @Param id path int true "标签ID"
// @Param name body string false "标签名称" minlength(3) maxlength(100)
// @Param state body int false "状态 (0为未删除、1为已删除)" Enums(0, 1) default(1)
// @Param modified_by body string true "修改者" minlength(3) maxlength(100)
// @Success 200 {array} model.Tag "成功"
// @Failure 400 {object} errcode.Error "请求错误"
// @Failure 500 {object} errcode.Error "内部错误"
// @Router /api/v1/tags/{id} [put]
func (t Tag) Update(c *gin.Context) {
}
4.针对整个项目进行注解,直接在main方法写入如下注解
//@title 项目名称
//@version 1.0
//@description 这里是描述
func main() {
5.生成执行 swag init
这时会在我项目的docs文件夹下面生成docs.go、swagger.json、swagger.yaml三个文件
6.要在routers中进行默认初始化和注册对应的路由:
r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
同时要引用 _"blog-service/docs",不然会报错
7.查看接口文档 :
8.ok,完成
关于go语言集成极光和golang集成开发环境的介绍到此就结束了 , 不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站 。

    推荐阅读