golang之git clone

Install Go1.6 from Source on CentOS 7 in China

  1. If there's old version of Go installed, unset $GOPATH, $GOROOT

  2. Make sure Git is installed.

    • Configure Git
      • git config --global user.email "email-for-github"
      • git config --global user.name "user name"
    • New SSH Key and Add Public Key to Github Account
      • ssh-keygen -t rsa -b 2048
      • fdipzone@ubuntu:~$ ssh-keygen -t rsa Generating public/private rsa key pair.
      • Enter file in which to save the key (/home/fdipzone/.ssh/id_rsa): 这里输入要生成的文件名
      • Enter passphrase (empty for no passphrase): 这里输入密码
      • Enter same passphrase again: 这里重复输入密码
      • Your identification has been saved in /home/fdipzone/.ssh/id_rsa. Your public key has been saved in /home/fdipzone/.ssh/id_rsa.pub. The key fingerprint is: f2:76:c3:6b:26:10:14:fc:43:e0:0c:4d:51:c9:a2:b0 fdipzone@ubuntu The key's randomart image is: +--[ RSA 2048]----+ | .+=*.. | | . += + | | o oo+ | | E . . o | | ..S. | | .o . | | .o + | | ...oo | | +. | +-----------------+
      • fdipzone@ubuntu:~$ ls -lt ~/.ssh
        总用量 12
        -rw------- 1 fdipzone fdipzone 1679 2015-08-07 00:28 id_rsa
        -rw-r--r-- 1 fdipzone fdipzone  397 2015-08-07 00:28 id_rsa.pub
      • https://github.com/settings/keys 设置 New Keys;(拷贝id_rsa.pub所有内容)
      • Copy the public key in ~/.ssh/id_rsa.pub and go to github SSH settings to add new SSH key.
  3. Install gcc and glibc-devel

  • sudo yum install gcc glibc-devel
  1. Build Go1.4 from source
  • cd ~/
  • git clone [email protected]:golang/go.git
  • cd go
  • git checkout -b 1.4.3 go1.4.3
  • cd src
  • ./all.bash
  1. Copy ~/go to $GOROOT_BOOTSTRAP(It's ~/go1.4 by default)`
  • cp ~/go ~/go1.4 -rf
  1. Build Go1.6 from source
  • cd ~/go
  • git clean -dfx
  • git checkout -b 1.6 go1.6
  • cd src
  • ./all.bash (默认当前环境的参数,如linux/amd64)
  • 但是如果编译需要linux/mipsle,此时不需要瞎搞,等待设置完环境变量后再搞;
  1. Set $GOPATH and add Go binary path to $PATH
  • sudo vi /etc/profile

        # Golang Env
        export PATH=$PATH:/home/xx/go/bin
        export GOPATH=/home/xx/go-projects
    
  1. Reboot and test
  • sudo reboot

  • go version

  • go version go1.6 linux/amd64

  • 2.交叉编译:(https://blog.csdn.net/QQ531456898/article/details/80095707

  • 命令: env GOOS=linux GOARCH=mipsle GOMIPS=softfloat go build -ldflags="-s -w" main.go
     

你可能感兴趣的:(GoLAND)