プログラミング + アカデミック + 何か面白いこと

  1. Programming
  2. 0 view

[Go]Install Go language on ubuntu

Pocket

Install

We can use apt to install go.

$ sudo apt-get install golang-go

Test Program

Making Workspace

It’s easy with managing to make work space .

You can use only mkdir command to make workspace.

$mkdir ~/go

And then setting workspace.

$vim ~/.bashrc
export GOPATH=$HOME/go
$source ~/.bashrc

Hello World

Try to make hello world program.

At first let’s make project.

$mkdir -p $GOPATH/src/example/hello

Finally programming.

package main

import "fmt"

func main() {
    fmt.Println("Hello, World!")
}

So simple.

And then run.

$pwd
$HOME/go
$go install example/hello
$ls
bin src
$ls bin
hello
$bin/hello
Hello, World!

Good!

Pocket

Programming recent post

  1. Install sbt 1.0.0 and run sample template

  2. [Machine Learning]Created docker image includ…

  3. [Node.js]How to write batch script with Node.…

  4. [Play][Scala]Develop Request Driven Batch Usi…

  5. [OpenCV][Ruby]Auto check web page design corr…

関連記事

PAGE TOP