Recording some of my work as I go through the go-tour
This commit is contained in:
parent
4618fcf851
commit
dd64e484a5
1
gotime/.gitignore
vendored
Normal file
1
gotime/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/bin/
|
12
gotime/Makefile
Normal file
12
gotime/Makefile
Normal file
@ -0,0 +1,12 @@
|
||||
SOURCES := $(shell find src -name '*.go')
|
||||
TARGETS := $(patsubst src/%.go,bin/%,$(SOURCES))
|
||||
|
||||
bin/%: src/%.go
|
||||
go build -o $@ $^
|
||||
|
||||
all: $(TARGETS)
|
||||
|
||||
clean:
|
||||
rm -v bin/*
|
||||
|
||||
.PHONY: all clean
|
0
gotime/bin/.gitkeep
Normal file
0
gotime/bin/.gitkeep
Normal file
18
gotime/src/maps.go
Normal file
18
gotime/src/maps.go
Normal file
@ -0,0 +1,18 @@
|
||||
// From go-tour #28
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
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"])
|
||||
}
|
Loading…
Reference in New Issue
Block a user