Coder Social home page Coder Social logo

go-multi-version's Introduction

一种实现在一台linux服务器上多个版本Go SDK兼容的方式

这是一种实现在一台机器上多个Go 版本 SDK 的兼容,并且不需要对本机安装的Go版本进行切换,只需传一个参数即可;

操作步骤

step1

先在机器上安装两个版本的go 版本,在文件夹/usr/local/下面安装两个版本的go sdk,如下,go1.14 和 go1.18

   [root@localhost local]# ls -al
   drwxr-xr-x.  2 root root   6 Aug  3 11:10 go1.14
   drwxr-xr-x.  2 root root   6 Aug  3 11:10 go1.18

step2:

把这个名为 go 的shell 放入 /usr/local/bin 目录下面,并 chmod 777 ,并将/usr/local/bin 加入 系统 PATH
     [root@localhost bin]# pwd
       /usr/local/bin
     [root@localhost bin]# chmod 777 go
     [root@localhost bin]# ls -al
      total 0
      drwxr-xr-x.  2 root root  16 Aug  3 11:18 .
      drwxr-xr-x. 14 root root 159 Aug  3 11:10 ..
      -rwxrwxrwx.  1 root root   0 Aug  3 11:18 go

使用

如果go shell文件里面 Default_Version=1.18 默认就是1.18,如果需要使用 1.14 则需要加 -v 14参数

   [root@localhost bin]# go version
   go version go1.18 linux/amd64
   [root@localhost bin]# go -v 14 version
   go version go1.14 linux/amd64
   

go-multi-version's People

Contributors

xuejiazhi avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.