网站首页 > 文章中心 > 其它

go语言的集成开发环境

作者:小编 更新时间:2023-09-28 18:43:00 浏览量:198人看过

如何配置go语言集成开发环境 vim

①.、编译vimgdb

go语言的集成开发环境-图1

mkdir -p ./tmp

cd tmp

安装依赖

sudo apt-get install build-essential

sudo apt-get build-dep vim-gtk

安装

// 这里直接执行make的操作

make

sudo make install

安装vimgdb runtime

cp vimgdb_runtime ~/.vim/bundle

打开vim

go语言的集成开发环境-图2

:helptags ~/.vim/bundle/vimgdb_runtime/doc " 生成doc文件

添加配置.vimrc

" vimgdb插件

run macros/gdb_mappings.vim

在vim中执行gdb时,报 "Unable to read from GDB pseudo tty" 的错误,因为没有安装 gdb ,所以安装gdb

sudo apt-get install gdb

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 '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

vim +PluginInstall +qall

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 BufWritePre Fmt

配置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

go get -u github.com/nsf/gocode (-u flag for "update")

Configure vim in .vimrc file

Plugin 'nsf/gocode', {'rtp': 'vim/'}

写一个helloword程序,输入fmt后按C-xC-o如果能看到函数的声明展示出来,说明安装是正确的.

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

Bundle 'dgryski/vim-godef'

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' : '.',

\ 't' : 'ctype',

\ 'n' : 'ntype'

\ },

\ 'ctype' : 't',

\ 'ntype' : 'n'

\ 'ctagsbin' : 'gotags',

\ 'ctagsargs' : '-sort -silent'

\ }

命令模式下按在右边就会显示当前文件下的函数名,结构体名等等,光标放到相应的tag上,按回车可以快速跳到程序中的相应位置.

再次按会关闭tag窗口.

PS:本地的.vimrc的配置

" 插件管理器 vundle

set nocompatible " be iMproved, required

filetype off " required

" Plugin 'tpope/vim-fugitive'

" Plugin 'Lokaltog/vim-easymotion'

" Plugin 'tpope/vim-rails.git'

" Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}

" Plugin 'FuzzyFinder'

" Plugin 'git://git.wincent.com/command-t.git'

" Plugin ''

filetype plugin indent on " required

" filetype plugin on

" : PluginList - list configured plugins

" : PluginInstall(!)- install (update) plugins

" : PluginClean(!) - confirm (or auto-approve) removal of unused plugins

" ********************************************************************

" 这里省略了其它不相关的插件

autocmd FileType go autocmd BufWritePre buffer Fmt

" 代码补全的插件

Bundle 'Blackrush/vim-gocode'

" 代码跳转提示

" 代码结构提示

LiteIDE使用

LiteIDE是一款开源,跨平台的轻量级Go语言集成开发环境.操作简单,提示迅速!当然不足之处也有很多,不过除了golad之外,个人觉得比vscode,eclipse等用的更舒心一点(ps:指的是编写golang,每个人的感受不一样,勿喷)

当我们使用一款IDE的时候,首先当然是配置一下环境,其次是快捷键,界面布局之类的了.所以,我们先来

①配置环境:

①1配置管理GOPATH/Modules/GOPROXY

将自己本地得GOPATH添加进去就可以了,如图所示可以添加多个.

可以使用M里面得go mod tidy也可以使用G键里面得Get按钮

目前记起来得就这么多,后续想起来后再添加.::)

Github上的一些高分Qt开源项目

TileMap

litego

Go语言的集成开发环境.

Clementine Music Player

功能很完善且跨平台支持做得很好的音乐播放器,完成度高,跨平台项目可以参考它.

QtAV

官网:

FFmpeg的Qt封装,国人的作品,为你点赞!

产品级的开源作品,值得研究.

qTox

livehelperchat

qupzilla

otter-browser

otter-browser (另一款Qt开发的Web浏览器):

Rythem (Qt版的fiddler)

官网:[ ]( )

ProjectTox-Qt-GUI (简版IM)

screencloud (截屏分享工具)

notes (记事本)

QFramer :(UI封装,国人作品)

JQTools , Jason Qt Tools 的简称

QtAwesome (Font Awesome support for Qt applications)

PacketSender

用于发送/接收TCP,UDP,SSL的网络工具,目前已经有桌面版、Android版本、IOS版本

Network utility for sending / receiving TCP, UDP, SSL

QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)

一款免费、开源、跨平台(支持Linux、Windows、Mac)的地理信息系统(GIS).

QtCipherSqlitePlugin

带有加密功能的 SQLite Qt 插件-QtCipherSqlitePlugin

A Qt plugin for ciphered SQLite.

RedisDesktopManager

跨平台开源 Redis ? 管理工具

RDM 是易于使用的 GUI 工具,可用于 Windows,Linux,MacOS 和 iPadOS.

Cross-platform GUI management tool for Redis

刘典武老师的CSDN:

刘典武老师的Github:

以上就是土嘎嘎小编为大家整理的go语言的集成开发环境相关主题介绍,如果您觉得小编更新的文章只要能对粉丝们有用,就是我们最大的鼓励和动力,不要忘记讲本站分享给您身边的朋友哦!!

版权声明:倡导尊重与保护知识产权。未经许可,任何人不得复制、转载、或以其他方式使用本站《原创》内容,违者将追究其法律责任。本站文章内容,部分图片来源于网络,如有侵权,请联系我们修改或者删除处理。

编辑推荐

热门文章