From dd64e484a578d42a8f84cb50916fafc5c17c5860 Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Sat, 25 Aug 2012 21:08:08 -0400 Subject: [PATCH] Recording some of my work as I go through the go-tour --- gotime/.gitignore | 1 + gotime/Makefile | 12 ++++++++++++ gotime/bin/.gitkeep | 0 gotime/src/maps.go | 18 ++++++++++++++++++ 4 files changed, 31 insertions(+) create mode 100644 gotime/.gitignore create mode 100644 gotime/Makefile create mode 100644 gotime/bin/.gitkeep create mode 100644 gotime/src/maps.go diff --git a/gotime/.gitignore b/gotime/.gitignore new file mode 100644 index 0000000..ae3c172 --- /dev/null +++ b/gotime/.gitignore @@ -0,0 +1 @@ +/bin/ diff --git a/gotime/Makefile b/gotime/Makefile new file mode 100644 index 0000000..a803d1d --- /dev/null +++ b/gotime/Makefile @@ -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 diff --git a/gotime/bin/.gitkeep b/gotime/bin/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/gotime/src/maps.go b/gotime/src/maps.go new file mode 100644 index 0000000..991285d --- /dev/null +++ b/gotime/src/maps.go @@ -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"]) +}