zoukankan      html  css  js  c++  java
  • GO (待更新)

    日期20190531,GO AND TOOLS FOR HOME

     0  环境搭建

    Install the Go tools
    
    If you are upgrading from an older version of Go you must first remove the existing version.
    Linux, macOS, and FreeBSD tarballs
    
    Download the archive and extract it into /usr/local, creating a Go tree in /usr/local/go. For example:
    
    tar -C /usr/local -xzf go1.12.5.linux-amd64.tar.gz
    
    (Typically these commands must be run as root or through sudo.)
    
    Add /usr/local/go/bin to the PATH environment variable. You can do this by adding this line to your /etc/profile (for a system-wide installation) or $HOME/.profile:
    
    export PATH=$PATH:/usr/local/go/bin
    
    Note: changes made to a profile file may not apply until the next time you log into your computer. To apply the changes immediately, just run the shell commands directly or execute them from the profile using a command such as source $HOME/.profile.
    Test your installation
    
    Check that Go is installed correctly by setting up a workspace and building a simple program, as follows.
    
    Create your workspace directory, $HOME/go. (If you'd like to use a different directory, you will need to set the GOPATH environment variable.)
    
    Next, make the directory src/hello inside your workspace, and in that directory create a file named hello.go that looks like:
    
    package main
    
    import "fmt"
    
    func main() {
        fmt.Printf("hello, world
    ")
    }
    
    Then build it with the go tool:
    
    $ cd $HOME/go/src/hello
    $ go build
    
    The command above will build an executable named hello in the directory alongside your source code. Execute it to see the greeting:
    
    $ ./hello
    hello, world
    
    If you see the "hello, world" message then your Go installation is working.
    
    You can run go install to install the binary into your workspace's bin directory or go clean -i to remove it.
    
    Before rushing off to write Go code please read the How to Write Go Code document, which describes some essential concepts about using the Go tools.
    Installing extra Go versions
    
    It may be useful to have multiple Go versions installed on the same machine, for example, to ensure that a package's tests pass on multiple Go versions. Once you have one Go version installed, you can install another (such as 1.10.7) as follows:
    
    $ go get golang.org/dl/go1.10.7
    $ go1.10.7 download
    
    The newly downloaded version can be used like go:
    
    $ go1.10.7 version
    go version go1.10.7 linux/amd64
    
    All Go versions available via this method are listed on the download page. You can find where each of these extra Go versions is installed by looking at its GOROOT; for example, go1.10.7 env GOROOT. To uninstall a downloaded version, just remove its GOROOT directory and the goX.Y.Z binary.
    Uninstalling Go
    
    To remove an existing Go installation from your system delete the go directory. This is usually /usr/local/go under Linux, macOS, and FreeBSD or c:Go under Windows.
    
    You should also remove the Go bin directory from your PATH environment variable. Under Linux and FreeBSD you should edit /etc/profile or $HOME/.profile. If you installed Go with the macOS package then you should remove the /etc/paths.d/go file. Windows users should read the section about setting environment variables under Windows. 

    Go 语言开发工具

    LiteIDE 是一款开源、跨平台的轻量级 Go 语言集成开发环境(IDE)。

    支持的 操作系统
    
        Windows x86 (32-bit or 64-bit)
        Linux x86 (32-bit or 64-bit)
    
    下载地址 :http://sourceforge.net/projects/liteide/files/
    
    源码地址 :https://github.com/visualfc/liteide
  • 相关阅读:
    Metropolis(大都会):以太坊网络的下一个阶段
    《区块链开发技术综述》乱弹
    Ext.Net学习笔记09:Ext.Net Store的用法
    Ext.Net学习笔记09:Ext.Net Store的用法
    Spring整合redis配置文件详解
    Spring整合redis配置文件详解
    Spring整合redis配置文件详解
    Spring整合redis配置文件详解
    Android环境配置----在Ubuntu上安装JDK
    Android环境配置----在Ubuntu上安装JDK
  • 原文地址:https://www.cnblogs.com/hdu-2010/p/11003486.html
Copyright © 2011-2022 走看看