go: add bazel buildfiles, implement leasifier
diff --git a/go/mirko/BUILD.bazel b/go/mirko/BUILD.bazel
new file mode 100644
index 0000000..59ed755
--- /dev/null
+++ b/go/mirko/BUILD.bazel
@@ -0,0 +1,16 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_library")
+
+go_library(
+    name = "go_default_library",
+    srcs = ["mirko.go"],
+    importpath = "code.hackerspace.pl/hscloud/go/mirko",
+    visibility = ["//visibility:public"],
+    deps = [
+        "//go/pki:go_default_library",
+        "//go/statusz:go_default_library",
+        "@com_github_golang_glog//:go_default_library",
+        "@org_golang_google_grpc//:go_default_library",
+        "@org_golang_google_grpc//reflection:go_default_library",
+        "@org_golang_x_net//trace:go_default_library",
+    ],
+)
diff --git a/go/mirko/mirko.go b/go/mirko/mirko.go
index 2e62c3d..01766db 100644
--- a/go/mirko/mirko.go
+++ b/go/mirko/mirko.go
@@ -38,17 +38,15 @@
 	httpServer *http.Server
 	httpMux    *http.ServeMux
 
-	ctx     context.Context
-	cancel  context.CancelFunc
-	waiters []chan bool
+	ctx    context.Context
+	cancel context.CancelFunc
 }
 
 func New() *Mirko {
 	ctx, cancel := context.WithCancel(context.Background())
 	return &Mirko{
-		ctx:     ctx,
-		cancel:  cancel,
-		waiters: []chan bool{},
+		ctx:    ctx,
+		cancel: cancel,
 	}
 }
 
@@ -161,10 +159,8 @@
 // Done() returns a channel that will emit a value when the service is
 // shut down. This should be used in the main() function instead of a select{}
 // call, to allow the background context to be canceled fully.
-func (m *Mirko) Done() chan bool {
-	c := make(chan bool, 1)
-	m.waiters = append(m.waiters, c)
-	return c
+func (m *Mirko) Done() <-chan struct{} {
+	return m.Context().Done()
 }
 
 // Serve starts serving HTTP and gRPC requests
@@ -187,10 +183,6 @@
 		select {
 		case <-signalCh:
 			m.cancel()
-			time.Sleep(time.Second)
-			for _, w := range m.waiters {
-				w <- true
-			}
 		}
 	}()