Switch to Go modules (#27)

This switches the library over to Go modules. This significantly
simplifies the Makefile.

We can also delete the old coverage shell script now that `./...` just
works.

As per https://github.com/golang/go/wiki/Modules#how-can-i-track-tool-dependencies-for-a-module,
tool dependencies have been added to tools.go.
diff --git a/.gitignore b/.gitignore
index 61ead86..b9a05e3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,4 @@
 /vendor
+cover.html
+cover.out
+/bin
diff --git a/.travis.yml b/.travis.yml
index a6412b7..786c917 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -5,6 +5,7 @@
 env:
   global:
     - GO15VENDOREXPERIMENT=1
+    - GO111MODULE=on
 
 go:
   - 1.11.x
@@ -18,16 +19,11 @@
 before_install:
 - go version
 
-install:
-- |
-  set -e
-  make install_ci
-
 script:
 - |
   set -e
   make lint
-  make test_ci
+  make cover
 
 after_success:
 - bash <(curl -s https://codecov.io/bash)
diff --git a/Makefile b/Makefile
index b4bf73d..4160182 100644
--- a/Makefile
+++ b/Makefile
@@ -1,23 +1,17 @@
-export GO15VENDOREXPERIMENT=1
-
-PACKAGES := $(shell glide nv)
+# Directory to put `go install`ed binaries in.
+export GOBIN ?= $(shell pwd)/bin
 
 GO_FILES := $(shell \
 	find . '(' -path '*/.*' -o -path './vendor' ')' -prune \
 	-o -name '*.go' -print | cut -b3-)
 
-.PHONY: install
-install:
-	glide --version || go get github.com/Masterminds/glide
-	glide install
-
 .PHONY: build
 build:
-	go build -i $(PACKAGES)
+	go build ./...
 
 .PHONY: test
 test:
-	go test -cover -race $(PACKAGES)
+	go test -race ./...
 
 .PHONY: gofmt
 gofmt:
@@ -25,50 +19,24 @@
 	@gofmt -e -s -l $(GO_FILES) > $(FMT_LOG) || true
 	@[ ! -s "$(FMT_LOG)" ] || (echo "gofmt failed:" | cat - $(FMT_LOG) && false)
 
-.PHONY: govet
-govet:
-	$(eval VET_LOG := $(shell mktemp -t govet.XXXXX))
-	@go vet $(PACKAGES) 2>&1 \
-		| grep -v '^exit status' > $(VET_LOG) || true
-	@[ ! -s "$(VET_LOG)" ] || (echo "govet failed:" | cat - $(VET_LOG) && false)
-
 .PHONY: golint
 golint:
-	@go get golang.org/x/lint/golint
-	$(eval LINT_LOG := $(shell mktemp -t golint.XXXXX))
-	@cat /dev/null > $(LINT_LOG)
-	@$(foreach pkg, $(PACKAGES), golint $(pkg) >> $(LINT_LOG) || true;)
-	@[ ! -s "$(LINT_LOG)" ] || (echo "golint failed:" | cat - $(LINT_LOG) && false)
+	@go install golang.org/x/lint/golint
+	@$(GOBIN)/golint ./...
 
 .PHONY: staticcheck
 staticcheck:
-	@go get honnef.co/go/tools/cmd/staticcheck
-	$(eval STATICCHECK_LOG := $(shell mktemp -t staticcheck.XXXXX))
-	@staticcheck $(PACKAGES) 2>&1 > $(STATICCHECK_LOG) || true
-	@[ ! -s "$(STATICCHECK_LOG)" ] || (echo "staticcheck failed:" | cat - $(STATICCHECK_LOG) && false)
+	@go install honnef.co/go/tools/cmd/staticcheck
+	@$(GOBIN)/staticcheck ./...
 
 .PHONY: lint
-lint: gofmt govet golint staticcheck
+lint: gofmt golint staticcheck
 
 .PHONY: cover
 cover:
-	./scripts/cover.sh $(shell go list $(PACKAGES))
+	go test -coverprofile=cover.out -coverpkg=./... -v ./...
 	go tool cover -html=cover.out -o cover.html
 
 update-license:
-	@go get go.uber.org/tools/update-license
-	@update-license \
-		$(shell go list -json $(PACKAGES) | \
-			jq -r '.Dir + "/" + (.GoFiles | .[])')
-
-##############################################################################
-
-.PHONY: install_ci
-install_ci: install
-	go get github.com/wadey/gocovmerge
-	go get github.com/mattn/goveralls
-	go get golang.org/x/tools/cmd/cover
-
-.PHONY: test_ci
-test_ci: install_ci
-	./scripts/cover.sh $(shell go list $(PACKAGES))
+	@go install go.uber.org/tools/update-license
+	@$(GOBIN)/update-license $(GO_FILES)
diff --git a/glide.lock b/glide.lock
deleted file mode 100644
index f9ea94c..0000000
--- a/glide.lock
+++ /dev/null
@@ -1,19 +0,0 @@
-hash: b53b5e9a84b9cb3cc4b2d0499e23da2feca1eec318ce9bb717ecf35bf24bf221
-updated: 2017-04-10T13:34:45.671678062-07:00
-imports:
-- name: go.uber.org/atomic
-  version: 3b8db5e93c4c02efbc313e17b2e796b0914a01fb
-testImports:
-- name: github.com/davecgh/go-spew
-  version: 6d212800a42e8ab5c146b8ace3490ee17e5225f9
-  subpackages:
-  - spew
-- name: github.com/pmezard/go-difflib
-  version: d8ed2627bdf02c080bf22230dbb337003b7aba2d
-  subpackages:
-  - difflib
-- name: github.com/stretchr/testify
-  version: 69483b4bd14f5845b5a1e55bca19e954e827f1d0
-  subpackages:
-  - assert
-  - require
diff --git a/go.mod b/go.mod
new file mode 100644
index 0000000..a500396
--- /dev/null
+++ b/go.mod
@@ -0,0 +1,13 @@
+module go.uber.org/multierr
+
+go 1.12
+
+require (
+	github.com/davecgh/go-spew v1.1.1 // indirect
+	github.com/stretchr/testify v1.3.0
+	go.uber.org/atomic v1.4.0
+	go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee
+	golang.org/x/lint v0.0.0-20190930215403-16217165b5de
+	golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c // indirect
+	honnef.co/go/tools v0.0.1-2019.2.3
+)
diff --git a/go.sum b/go.sum
new file mode 100644
index 0000000..174cd00
--- /dev/null
+++ b/go.sum
@@ -0,0 +1,43 @@
+github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
+github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
+github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
+github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
+github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
+github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
+github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
+github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
+github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
+github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
+github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
+github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
+github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
+go.uber.org/atomic v1.4.0 h1:cxzIVoETapQEqDhQu3QfnvXAV4AlzcvUCxkVUFw3+EU=
+go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
+go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee h1:0mgffUl7nfd+FpvXMVz4IDEaUSmT1ysygQC7qYo7sG4=
+go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA=
+golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
+golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
+golang.org/x/lint v0.0.0-20190930215403-16217165b5de h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs=
+golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
+golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
+golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190620200207-3b0461eec859 h1:R/3boaszxrf1GEUWTVDzSKVwLmSJpwZ1yqXm8j0v2QI=
+golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
+golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
+golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
+golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c h1:IGkKhmfzcztjm6gYkykvu/NiS8kaqbCWAEWWAyf8J5U=
+golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
+honnef.co/go/tools v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM=
+honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
diff --git a/scripts/cover.sh b/scripts/cover.sh
deleted file mode 100755
index e7f2b88..0000000
--- a/scripts/cover.sh
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/bin/bash -e
-
-COVER=cover
-ROOT_PKG=go.uber.org/multierr
-
-if [[ -d "$COVER" ]]; then
-	rm -rf "$COVER"
-fi
-mkdir -p "$COVER"
-
-i=0
-for pkg in "$@"; do
-	i=$((i + 1))
-
-	extracoverpkg=""
-	if [[ -f "$GOPATH/src/$pkg/.extra-coverpkg" ]]; then
-		extracoverpkg=$( \
-			sed -e "s|^|$pkg/|g" < "$GOPATH/src/$pkg/.extra-coverpkg" \
-			| tr '\n' ',')
-	fi
-
-	coverpkg=$(go list -json "$pkg" | jq -r '
-		.Deps
-		| . + ["'"$pkg"'"]
-		| map
-			( select(startswith("'"$ROOT_PKG"'"))
-			| select(contains("/vendor/") | not)
-			)
-		| join(",")
-	')
-	if [[ -n "$extracoverpkg" ]]; then
-		coverpkg="$extracoverpkg$coverpkg"
-	fi
-
-	go test \
-		-coverprofile "$COVER/cover.${i}.out" -coverpkg "$coverpkg" \
-		-v "$pkg"
-done
-
-gocovmerge "$COVER"/*.out > cover.out
diff --git a/tools.go b/tools.go
new file mode 100644
index 0000000..df93f07
--- /dev/null
+++ b/tools.go
@@ -0,0 +1,30 @@
+// Copyright (c) 2019 Uber Technologies, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+// +build tools
+
+package multierr
+
+import (
+	// Tools we use during development.
+	_ "go.uber.org/tools/update-license"
+	_ "golang.org/x/lint/golint"
+	_ "honnef.co/go/tools/cmd/staticcheck"
+)