Go语言基础

版本管理

GVM简介

GVM 是 Go Version Manager,可用于管理Go的版本,主要特性有: - 管理 Go 的多个版本,包括安装、卸载和指定使用 Go 的某个版本; - 查看官方所有可用的 Go 版本,同时可以查看本地已安装和默认使用的 Go 版本; - 管理多个 GOPATH,并可编辑 Go 的环境变量; - 可将当前目录关联到 GOPATH; - 可以查看 GOROOT 下的文件差异。

安装

bash < <(curl -s -S -L 
https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)

使用GVM

  ~ gvm     
Usage: gvm [command]
 
Description:
  GVM is the Go Version Manager
 
Commands:
  version    - print the gvm version number
  get        - gets the latest code (for debugging)
  use        - select a go version to use (--default to set permanently)
  diff       - view changes to Go root
  help       - display this usage text
  implode    - completely remove gvm
  install    - install go versions
  uninstall  - uninstall go versions
  cross      - install go cross compilers
  linkthis   - link this directory into GOPATH
  list       - list installed go versions
  listall    - list available versions
  alias      - manage go version aliases
  pkgset     - manage go packages sets
  pkgenv     - edit the environment for a package set