[Go] Methods and Interfaces その1

### Method
A method is a function with a special receiver argument.

type Vertex struct {
	X, Y float64
}

func (v Vertex) Abs() float64 {
	return math.Sqrt(v.X*v.X + v.Y*v.Y)
}

func main(){
	v := Vertex{3, 4}
	fmt.Println(v.Abs())
}

– Methods are functions
You can declare a method on non-struct types, too.

type MyFloat float64

func (f MyFloat) Abs() float64 {
	if f < 0 {
		return float64(-f)
	}
	return float64(f)
}

func main(){
	f := MyFloat(-math.Sqrt2)
	fmt.Println(f.Abs())
}

– Pointer receivers
You can declare methods with pointer receivers.

type Vertex struct {
	X, Y float64
}

func (v Vertex) Abs() float64 {
	return math.Sqrt(v.X*v.X + v.Y*v.Y)
}

func (v *Vertex) Scale(f float64){
	v.X = v.X * f
	v.Y = v.Y * f
}

func main(){
	v := Vertex{3, 4}
	v.Scale(10)
	fmt.Println(v.Abs())
}

### Interface
An interface type is defined as a set of method signatures

type Abser interface {
	Abs() float64
}

func main(){
	var a Abser
	f := MyFloat(-math.Sqrt2)
	v := Vertex{3, 4}

	a = f
	a = &v

	a = v

	fmt.Println(a.Abs())
}

type MyFloat float64

func(f MyFloat) Abs() float64 {
	if f < 0 {
		return float64(-f)
	}
	return float64(f)
}

type Vertex struct {
	X, Y float64
}

func(v *Vertex) Abs() float64 {
	return math.Sqrt(v.X*v.X + v.Y*v.Y)
}

# command-line-arguments
./hello.go:19:4: cannot use v (type Vertex) as type Abser in assignment:
Vertex does not implement Abser (Abs method has pointer receiver)

– Interfaces are implemented implicitly
A type implements an interface by implementing its methods. There is no explicit declaration of intent, no “implements” keyword.

type I interface {
	M()
}

type T struct {
	S string
}

func (t T) M(){
	fmt.Println(t.S)
}

func main(){
	var i I = T{"hello"}
	i.M()
}

– Interface values
Under the hood, interface values can be thought of as a tuple of value and a concrete type.

type I interface {
	M()
}

type T struct {
	S string
}

func (t *T) M(){
	fmt.Println(t.S)
}

type F float64

func(f F) M(){
	fmt.Println(f)
}

func main(){
	var i I
	i = &T{"hello"}
	describe(i)
	i.M()

	i = F(math.Pi)
	describe(i)
	i.M()
}

func describe(i I){
	fmt.Printf("(%v, %T)\n", i, i)
}

interfaceやったなあ

[Go] structs, slices, and maps その3

### Maps
A map maps key to values.

type Vertex struct {
	Lat, Long float64
}

var m map[string]Vertex

func main(){
	m = make(map[string]Vertex)
	m["Bell Labs"] = Vertex{
		40.68433, -74.39967,
	}
	fmt.Println(m["Bell Labs"])
}

– Map leterals
Map literals are like struct literals, but the keys are requried

type Vertex struct {
	Lat, Long float64
}

var m = map[string]Vertex{
	"Bell Labs" : Vertex{
		40.68433, -74.39967,
	},
	"Google": Vertex {
		37.42202, -122.08408,
	},
}

func main(){	
	fmt.Println(m)
}

– Map literals continued
If the top-level type is just a type name, you can omit it from the elements of the literal.

– Mutating Maps
Insert, Retrieve, Delete

func main(){
	m := make(map[string]int)

	m["Answer"] = 42	
	fmt.Println("The value:", m["Answer"])

	m["Answer"] = 48
	fmt.Println("The value:", m["Answer"])

	delete(m, "Answer")
	fmt.Println("The value:", m["Answer"])

	v, ok := m["Answer"]
	fmt.Println("The value:", v, "Present?", ok)
}

### Function values
Functions are values too. They can be passed around just like other values. Function values may be used as function arguments and return values.

func compute(fn func(float64, float64) float64) float64 {
	return fn(3, 4)
}

func main(){
	hypot := func(x, y float64) float64 {
		return math.Sqrt(x*x + y*y)
	}

	fmt.Println(hypot(5, 12))

	fmt.Println(compute(hypot))
	fmt.Println(compute(math.Pow))
}

– Function closures
A closure is a function value that references variables from outside its body. The function may access and assign to the referenced variables.

func adder() func(int) int {
	sum := 0
	return func(x int) int {
		sum += x
		return sum
	}
}

func main(){
	pos, neg := adder(), adder()
	for i := 0; i<10; i++ {
		fmt.Println(
			pos(i),
			neg(-2*i),
		)
	}
}

$ go build hello.go && ./hello
0 0
1 -2
3 -6
6 -12
10 -20
15 -30
21 -42
28 -56
36 -72
45 -90

うむ、GoにもなるとTutorialのレベルが高いな

[Go] structs, slices, and maps その2

– Slice default
When slicing, you may omit the high or low bounds to use their defaults instead.

func main(){
	s := []int{2, 3, 5, 7, 11, 13}

	s = s[1:4]
	fmt.Println(s)

	s = s[:2]
	fmt.Println(s)

	s = s[1:]
	fmt.Println(s)
}

– Slice length and capacity
The length of a slice is the number of elements it contains. The capacity of a slice is the number of elements in the underlying array, counting from the first element in the slice.

func main(){
	s := []int{2, 3, 5, 7, 11, 13}
	printSlice(s)

	s = s[:0]
	printSlice(s)

	s = s[:4]
	printSlice(s)

	s = s[2:]
	printSlice(s)
}

func printSlice(s []int){
	fmt.Printf("len=%d cap=%d %v\n", len(s), cap(s), s)
}

$ go build hello.go && ./hello
len=6 cap=6 [2 3 5 7 11 13]
len=0 cap=6 []
len=4 cap=6 [2 3 5 7]
len=2 cap=4 [5 7]

Nil slices
– The zero value of a slice is nil.

func main(){
	var s[]int
	fmt.Println(s, len(s), cap(s))
	if s == nil {
		fmt.Println("nil!")
	}
}

– Creating a slice with make
The make function allocate a zeroed array and returns a slice that refers to that array.

func main(){
	a := make([]int, 5)
	printSlice("a", a)

	b := make([]int, 0, 5)
	printSlice("b", b)

	c := b[:2]
	printSlice("c", c)

	d := c[2:5]
	printSlice("d", d)
}


func printSlice(s string, x []int){
	fmt.Printf("%s len=%d cap=%d %v\n", s, len(x), cap(x), x)
}

$ go build hello.go && ./hello
a len=5 cap=5 [0 0 0 0 0]
b len=0 cap=5 []

– Slices of slices
Slices can contain any type, including other slices.

func main(){
	board := [][]string {
		[]string{"_","_","_"},
		[]string{"_","_","_"},
		[]string{"_","_","_"},
	}

	board[0][0] = "X"
	board[2][2] = "0"
	board[1][2] = "X"
	board[1][0] = "0"
	board[0][2] = "X"

	for i := 0; i < len(board); i++ {
		fmt.Printf("%s\n", strings.Join(board[i], " "))
	}
}

$ go build hello.go && ./hello
X _ X
0 _ X
_ _ 0

– Appending to a slice
It is common to append new elements to a slice, and so Go provides a built-in append function.

func main(){
	var s []int
	printSlice(s)

	s = append(s, 0)
	printSlice(s)

	s = append(s, 1)
	printSlice(s)

	s = append(s, 2, 3, 4)
	printSlice(s)
}

func printSlice(s []int){
	fmt.Printf("len=%d cap=%d %v\n", len(s), cap(s), s)
}

### Range
When ranging over a slice, two values are returned for each iteration. The first is the index, and the second is a copy of the element at that index.

var pow = []int{1, 2, 4, 8, 16, 32, 64, 128}

func main(){
	for i, v := range pow {
		fmt.Printf("2**%d = %d\n", i, v)
	}
}

$ go build hello.go && ./hello
2**0 = 1
2**1 = 2
2**2 = 4
2**3 = 8
2**4 = 16
2**5 = 32
2**6 = 64
2**7 = 128

– Range continued
You can skip the index or value by assigning to _.

func main(){
	pow := make([]int, 10)
	for i := range pow {
		pow[i] = 1 << uint(i) // == 2**i
	}
	for _, value := range pow {
		fmt.Printf("%d\n", value)
	}
}

なるほど、Sliceって連想配列のような使い方ができるのね。

[Go] structs, slices, and maps その1

### Pointers
Go has pointers. A pointer holds the memory address of a value.
The type *T is a pointer to a T value. Its zero value is nil

func main(){
	i, j := 42, 2701

	p := &i
	fmt.Println(*p)
	*p = 21
	fmt.Println(i)

	p = &j
	*p = *p / 37
	fmt.Println(j)
}

$ go build hello.go && ./hello
42
21
73

### Structs
A struct is a collection of fields.

type Vertex struct {
	X int
	Y int
}

func main(){
	fmt.Println(Vertex{1, 2})
}

Struct fields are accessed using a dot.

type Vertex struct {
	X int
	Y int
}

func main(){
	v := Vertex{1, 2}
	v.X = 4
	fmt.Println(v.X)
}

Pointers to structs

type Vertex struct {
	X int
	Y int
}

func main(){
	v := Vertex{1, 2}
	p := &v
	p.X = 1e9
	fmt.Println(v)
}

$ go build hello.go && ./hello
{1000000000 2}

– Struct Literals
A struct literal donates a newly allocated struct value by listing the values of its fields.

var (
	v1 = Vertex{1, 2}
	v2 = Vertex{X: 1}
	v3 = Vertex{}
	p = &Vertex{1, 2}
)

func main(){
	fmt.Println(v1, p, v2, v3)
}

$ go build hello.go && ./hello
{1 2} &{1 2} {1 0} {0 0}

### Arrays
The type [n]T is an array of n values of type T.

func main(){
	var a [2]string
	a[0] = "Hello"
	a[1] = "world"
	fmt.Println(a[0], a[1])
	fmt.Println(a)

	primes := [6]int{2, 3, 5, 7, 11, 13}
	fmt.Println(primes)
}

$ go build hello.go && ./hello
Hello world
[Hello world]
[2 3 5 7 11 13]

– Slices
An array has a fixed size. A slice, on the other hand, is a dynamically-sized, flexible view into the elements of an array.

func main(){
	primes := [6]int{2, 3, 5, 7, 11, 13}

	var s []int = primes[1:4]
	fmt.Println(s)
}

– Slices are like references to arrays
A slice does not store any data, it just describes a section of an underlying array.

func main(){
	names := [4]string{
		"John",
		"Paul",
		"George",
		"Ringo",
	}
	fmt.Println(names)

	a := names[0:2]
	b := names[1:3]

	b[0] = "XXX"
	fmt.Println(a, b)
	fmt.Println(names)
}

$ go build hello.go && ./hello
[John Paul George Ringo]
[John XXX] [XXX George]
[John XXX George Ringo]

– Slice literals
A slice literal is like an array literal without the length.

func main(){
	q := []int{2, 3, 5, 7, 11, 13}
	fmt.Println(q)

	r := []bool{true, false, true, true, false, true}
	fmt.Println(r)

	s := []struct {
		i int
		b bool
	}{
		{2, true},
		{3, false},
		{5, true},
		{7, true},
		{11, false},
		{13, true},
	}
	fmt.Println(s)
}

C言語をやってからポインターは暫く離れていたが、Goもポインター使うのか。

[Go] Flow control statement

### For
Go has only one looping construct, the for loop

func main(){
	sum := 0;
	for i := 0; i < 10; i++ {
		sum += i
	}
	fmt.Println(sum)
}

The init and post statements are optional

func main(){
	sum := 1;
	for ; sum < 1000; {
		sum += sum
	}
	fmt.Println(sum)
}

For is Go’s “while”
At that point you can drop the semicolons: C’s while is spelled for in Go.

func main(){
	sum := 1;
	for sum < 1000 {
		sum += sum
	}
	fmt.Println(sum)
}

### If
Go’s if statements are like its for loops.

func sqrt(x float64) string {
	if x < 0 {
		return sqrt(-x) + "i"
	}
	return fmt.Sprint(math.Sqrt(x))
}

func main(){
	fmt.Println(sqrt(2), sqrt(-4))
}

If with a short statement

func pow(x, n, lim float64) float64 {
	if v := math.Pow(x, n); v < lim {
		return v
	} else {
		fmt.Printf("%g >= %g\n", v, lim)
	}
	return lim
}

func main(){
	fmt.Println(
		pow(3, 2, 10),
		pow(3, 3, 20),
	)
}

### Switch
A switch statement is a shorter way to write a sequence of if – else statements.

func main(){
	fmt.Print("Go runs on ")
	switch os := runtime.GOOS; os{
	case "darwin":
		fmt.Println("OS X.")
	case "linux":
		fmt.Println("Linux.")
	default:
		fmt.Println("%s.\n", os)
	}
}
func main(){
	fmt.Print("When's Saturday?")
	today := time.Now().Weekday()
	switch time.Saturday{
	case today + 0:
		fmt.Println("Today.")
	case today + 1:
		fmt.Println("Tommorow.")
	case today + 2:
		fmt.Println("In two days.")
	default:
		fmt.Println("Too far away.")
	}
}
func main(){
	t := time.Now()
	switch {
	case t.Hour() < 12:
		fmt.Println("Good morning!")
	case t.Hour() < 17:
		fmt.Println("Good afternoon.")
	default:
		fmt.Println("Good evening.")
	}
}

### Defer
A defer statement defers the execution of a function until the surrounding function returns.

func main(){
	defer fmt.Println("wrold")

	fmt.Println("hello")
}

$ go build hello.go && ./hello
hello
wrold

Stacking defers
L Deferred function calls are pushed onto a stack.

func main(){
	fmt.Println("counting")

	for i := 0; i < 10; i++ {
		defer fmt.Println(i)
	}

	fmt.Println("done")
}

deferってのは使い方がよくわからんが、最初は参照しながら書けば問題なさそうです。

[Go] Variables, Functions その2

#### function
– Named return values
names should be used to document the meaning of the return values.

func split(sum int)(x, y int) {
	x = sum * 4 / 9
	y = sum - x
	return
}

func main(){
	fmt.Println(split(17))
}

$ go build hello.go && ./hello
7 10

### Variables
The var statement declares a list of variables, as in function argument lists, the type is last.

var c, python, java bool

func main(){
	var i int
	fmt.Println(i, c, python, java)
}

initializer
short variable
L inside a function, the := short assignment statement can be used in place of var declaration with implicit type.

var i, j int = 1, 2

func main(){
	var c, python, java = true, false, "no!"
	k := 3
	fmt.Println(i, j, k, c, python, java)
}

$ go build hello.go && ./hello
1 2 3 true false no!

Basic types
L bool, string, int, uint, byte, rune, float32, float64, complex64, complex128

import (
	"fmt"
	"math/cmplx"
)

var (
	ToBe bool = false
	MaxInt uint64 = 1<<64 -1
	z complex128 = cmplx.Sqrt(-5 + 12i)
)

func main(){
	fmt.Printf("Type: %T Value: %v\n", ToBe, ToBe)
	fmt.Printf("Type: %T Value: %v\n", MaxInt, MaxInt)
	fmt.Printf("Type: %T Value: %v\n", z, z)
}

$ go build hello.go && ./hello
Type: bool Value: false
Type: uint64 Value: 18446744073709551615
Type: complex128 Value: (2+3i)

Zero values

package main
import "fmt"

func main(){
	var i int
	var f float64
	var b bool
	var s string
	fmt.Printf("%v %v %v %q\n", i, f, b, s)
}

$ go build hello.go && ./hello
0 0 false “”

Type conversions
– The expression T(v) converts the value v to the type T.

import (
	"fmt"
	"math"
)

func main(){
	var x, y int = 3, 4
	var f float64 = math.Sqrt(float64(x*x + y*y))
	var z uint = uint(f)
	fmt.Println(x, y, z)
}

$ go build hello.go && ./hello
3 4 5

Type inference
– The variable’s type is inferred from the value on the right hand side.

func main(){
	v := 42
	fmt.Printf("v is of type %T\n", v)
}

$ go build hello.go && ./hello
v is of type int

Constants
– constants are declared like variables, but with the const keyword.

const Pi = 3.14

func main(){
	const World = "世界"
	fmt.Println("Hello", World)
	fmt.Println("Hello", Pi, "Day")

	const Truth = true
	fmt.Println("Go rules", Truth)
}

$ go build hello.go && ./hello
Hello 世界
Hello 3.14 Day
Go rules true

Numeric Constants

const (
	Big = 1 << 100
	Small = Big >> 99
)

func needInt(x int) int {return x*10 + 1}
func needFloat(x float64) float64 {
	return x * 0.1
}

func main(){
	fmt.Println(needInt(Small))
	fmt.Println(needFloat(Small))
	fmt.Println(needFloat(Big))
}

$ go build hello.go && ./hello
21
0.2
1.2676506002282295e+29

ふう…
英語だと変な脳みそ使うね

[Go] Packages, Variables, Functions その1

Every Go is made up of packages. Programs start running in package main.

package main
import(
	"fmt"
	"math/rand"
) 

func main(){
	fmt.Println("My favorite number is", rand.Intn(10))
}

$ go build hello.go && ./hello
My favorite number is 1

### import
“factored” import statement

import(
	"fmt"
	"math"
) 

func main(){
	fmt.Printf("Now you have %g problems.\n", math.Sqrt(7))
}

$ go build hello.go && ./hello
Now you have 2.6457513110645907 problems.

### Exported names
A name is exported if it begins with a capital letter
it can not be used “math.pi”

import(
	"fmt"
	"math"
) 

func main(){
	fmt.Println(math.Pi)
}

### Functions
A function can take zero or more arguments.
The type comes after variable name.

func add(x int, y int) int {
	return x + y
}

func main(){
	fmt.Println(add(22, 34))
}

$ go build hello.go && ./hello
56

When two or more consecutive named function parameters share a type, can omit the type from all but the last

func add(x, y int) int {
	return x + y
}

function can return any number of results

func swap(x, y string)(string, string) {
	return y, x
}

func main(){
	a, b := swap("hello", "go")
	fmt.Println(a, b)
}

$ go build hello.go && ./hello
go hello

おおお、なんか凄いな

[Go] 初めてのGo言語

$ sudo yum install golang
$ go version
go version go1.15.14 linux/amd64

### 基礎

package main
import(
	"fmt"
) 

func main(){
	// var name string = "yamada"
	name := "yamada"

	fmt.Println(name)
}

$ go build hello.go && ./hello
yamada

なんか世界観が変わるな

import(
	"fmt"
	"time"
) 

func main(){

	fmt.Println("The time is", time.Now())
}

$ go build hello.go && ./hello
The time is 2021-09-16 07:03:44.729927623 +0900 JST m=+0.000027657

なるほど、Go言語とTypeScriptで攻めたい

ubuntuのgolangをアップデート

ubuntuのgolangをアップデートします
vagrant@vagrant-ubuntu-trusty-64:~/ethereum$ go env
GOARCH=”amd64″
GOBIN=””
GOCHAR=”6″
GOEXE=””
GOHOSTARCH=”amd64″
GOHOSTOS=”linux”
GOOS=”linux”
GOPATH=””
GORACE=””
GOROOT=”/usr/lib/go”
GOTOOLDIR=”/usr/lib/go/pkg/tool/linux_amd64″
TERM=”dumb”
CC=”gcc”
GOGCCFLAGS=”-g -O2 -fPIC -m64 -pthread”
CXX=”g++”
CGO_ENABLED=”1″
vagrant@vagrant-ubuntu-trusty-64:~/ethereum$ sudo apt-get update
vagrant@vagrant-ubuntu-trusty-64:~/ethereum$ sudo apt-get install gcc make
vagrant@vagrant-ubuntu-trusty-64:~/ethereum$ sudo apt-get install golang-1.10
vagrant@vagrant-ubuntu-trusty-64:~/ethereum$ ls /usr/lib | grep go
go
go-1.10
gold-ld
vagrant@vagrant-ubuntu-trusty-64:~/ethereum$ cd /usr/bin
vagrant@vagrant-ubuntu-trusty-64:/usr/bin$ sudo mv go go_16
vagrant@vagrant-ubuntu-trusty-64:/usr/bin$ sudo mv gofmt gofmt_16
vagrant@vagrant-ubuntu-trusty-64:/usr/bin$ sudo ln -s /usr/lib/go-1.10/bin/go /usr/bin/go
vagrant@vagrant-ubuntu-trusty-64:/usr/bin$ sudo ln -s /usr/lib/go-1.10/bin/gofmt /usr/bin/gofmt
vagrant@vagrant-ubuntu-trusty-64:/usr/bin$ go version
go version go1.10.4 linux/amd64

OK^^

再度makeします
vagrant@vagrant-ubuntu-trusty-64:~/ethereum$ make -C go-ethereum geth

/usr/lib/go-1.10/pkg/tool/linux_amd64/link: -X flag requires argument of the form importpath.name=value

何いいいいいいいいいいいいい

Ethereumのインストール

ubuntuにgo言語実装のgo-ethereumを入れる
vagrant@vagrant-ubuntu-trusty-64:~$ mkdir ethereum
vagrant@vagrant-ubuntu-trusty-64:~$ ls
ethereum
vagrant@vagrant-ubuntu-trusty-64:~$ cd ethereum
vagrant@vagrant-ubuntu-trusty-64:~/ethereum$ sudo apt-get install -y build-essential libgmp3-dev golang

vagrant@vagrant-ubuntu-trusty-64:~/ethereum$ sudo apt-get install git
vagrant@vagrant-ubuntu-trusty-64:~/ethereum$ git version
git version 1.9.1

vagrant@vagrant-ubuntu-trusty-64:~/ethereum$ git clone -b release/1.3.6 https://github.com/ethereum/go-ethereum.git

おおお

vagrant@vagrant-ubuntu-trusty-64:~/ethereum$ make -C go-ethereum geth
make: Entering directory `/home/vagrant/ethereum/go-ethereum’
build/env.sh go install -v -ldflags ‘-X main.gitCommit bf324bd24be9036046e36c6248b2d7c31cce9eca’ ./cmd/geth
github.com/codegangsta/cli
github.com/ethereum/go-ethereum/rlp
# github.com/ethereum/go-ethereum/rlp
build/_workspace/src/github.com/ethereum/go-ethereum/rlp/encode.go:162: undefined: sync.Pool
github.com/ethereum/go-ethereum/crypto/ecies
github.com/ethereum/go-ethereum/crypto/sha3
github.com/ethereum/go-ethereum/crypto/randentropy
github.com/ethereum/go-ethereum/crypto/secp256k1
github.com/pborman/uuid
golang.org/x/crypto/pbkdf2
golang.org/x/crypto/ripemd160
golang.org/x/crypto/scrypt
github.com/ethereum/go-ethereum/logger/glog
github.com/ethereum/go-ethereum/params
github.com/hashicorp/golang-lru
github.com/rcrowley/go-metrics
github.com/syndtr/goleveldb/leveldb/util
github.com/syndtr/goleveldb/leveldb/cache
github.com/syndtr/goleveldb/leveldb/comparer
github.com/syndtr/goleveldb/leveldb/storage
github.com/syndtr/goleveldb/leveldb/errors
github.com/syndtr/goleveldb/leveldb/filter
github.com/syndtr/goleveldb/leveldb/iterator
github.com/syndtr/goleveldb/leveldb/journal
github.com/syndtr/goleveldb/leveldb/memdb
github.com/syndtr/goleveldb/leveldb/opt
github.com/syndtr/gosnappy/snappy
github.com/syndtr/goleveldb/leveldb/table
github.com/syndtr/goleveldb/leveldb
gopkg.in/karalabe/cookiejar.v2/collections/prque
github.com/ethereum/go-ethereum/event
gopkg.in/fatih/set.v0
github.com/huin/goupnp/httpu
github.com/huin/goupnp/scpd
github.com/huin/goupnp/soap
github.com/huin/goupnp/ssdp
golang.org/x/net/html/atom
golang.org/x/net/html
golang.org/x/text/transform
golang.org/x/text/encoding
golang.org/x/text/encoding/internal/identifier
golang.org/x/text/encoding/internal
golang.org/x/text/encoding/charmap
golang.org/x/text/encoding/japanese
golang.org/x/text/encoding/korean
golang.org/x/text/encoding/simplifiedchinese
golang.org/x/text/encoding/traditionalchinese
golang.org/x/text/encoding/unicode
golang.org/x/net/html/charset
github.com/huin/goupnp
# github.com/huin/goupnp
build/_workspace/src/github.com/ethereum/go-ethereum/Godeps/_workspace/src/github.com/huin/goupnp/goupnp.go:113: unknown http.Client field ‘Timeout’ in struct literal
github.com/jackpal/go-nat-pmp
github.com/ethereum/go-ethereum/event/filter
github.com/robertkrimen/otto/file
github.com/robertkrimen/otto/token
github.com/robertkrimen/otto/ast
github.com/robertkrimen/otto/dbg
github.com/robertkrimen/otto/parser
github.com/robertkrimen/otto/registry
github.com/robertkrimen/otto
github.com/rs/cors
github.com/peterh/liner
github.com/mattn/go-isatty
github.com/shiena/ansicolor
github.com/fatih/color
github.com/mattn/go-runewidth
github.com/nsf/termbox-go
github.com/gizak/termui
make: *** [geth] Error 2
make: Leaving directory `/home/vagrant/ethereum/go-ethereum’

vagrant@vagrant-ubuntu-trusty-64:~/ethereum$ go version
go version go1.2.1 linux/amd64

https://github.com/ethereum/go-ethereum

Building geth requires both a Go (version 1.10 or later) and a C compiler. You can install them using your favourite package manager. Once the dependencies are installed, run

あれ?