我是靠谱客的博主 威武缘分,这篇文章主要介绍Centos7安装Golang1.6,并配置vim环境,现在分享给大家,希望可以做个参考。

http://icsmile.com/2016/03/31/centos7_go1.6/

在CentOS7下安装golang1.6版本,并进行vim高亮配置

安装

  • 卸载之前的版本
复制代码
1
yum remove golang
  • 下载Golang1.6
复制代码
1
2
wget http://www.golangtc.com/static/go/1.6/go1.6.linux-amd64.tar.gz tar -zxvf go1.6.linux-amd64.tar.gz
复制代码
1
修改环境变量文件和工作环境

由于个人喜好,我的工作目录都在opt下,故设置golang的工作目录为/opt/golang

复制代码
1
2
3
4
5
6
mkdir /opt/golang vim ~/.bash_profile export GOPATH=/opt/golang export GOROOT=/root/golang export PATH=$PATH:$GOROOT/bin
  • 重载环境变量
复制代码
1
source ~/.bash_profile
  • 确认版本
复制代码
1
2
3
go version #go version go1.6 linux/amd64

配置vim

  • 首先安装Vundle
复制代码
1
git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim
  • 配置.vimrc

以下是我的配置环境,仅供参考

复制代码
1
2
3
4
5
6
7
8
9
10
11
vim ~/.vimrc set nocompatible " be iMproved, required filetype off " required set rtp+=~/.vim/bundle/Vundle.vim call vundle#begin() Plugin 'gmarik/Vundle.vim' Plugin 'fatih/vim-go' call vundle#end() " required filetype plugin indent on " required syntax on
  • 安装vim-go
复制代码
1
git clone https://github.com/fatih/vim-go.git ~/.vim/bundle/vim-go

安装完成!

最后

以上就是威武缘分最近收集整理的关于Centos7安装Golang1.6,并配置vim环境的全部内容,更多相关Centos7安装Golang1内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(54)

评论列表共有 0 条评论

立即
投稿
返回
顶部