From c4905f234744c0ad0a2695180a127bea80396c30 Mon Sep 17 00:00:00 2001 From: Jehiah Czebotar Date: Tue, 31 Oct 2017 09:12:15 -0400 Subject: [PATCH] Switch from gpm -> dep for dependency management --- .gitignore | 11 ++-- .travis.yml | 10 ++-- Godeps | 13 ----- Gopkg.lock | 117 ++++++++++++++++++++++++++++++++++++++ Gopkg.toml | 40 +++++++++++++ test.sh | 21 ++++--- validator_test.go | 2 +- validator_watcher_test.go | 2 +- 8 files changed, 182 insertions(+), 34 deletions(-) delete mode 100644 Godeps create mode 100644 Gopkg.lock create mode 100644 Gopkg.toml diff --git a/.gitignore b/.gitignore index c51af8d..74de2e7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,10 @@ -google_auth_proxy oauth2_proxy +vendor +dist +.godeps +*.exe + + # Go.gitignore # Compiled Object files, Static and Dynamic libs (Shared Objects) *.o @@ -22,9 +27,5 @@ _cgo_export.* _testmain.go -*.exe -dist -.godeps - # Editor swap/temp files .*.swp diff --git a/.travis.yml b/.travis.yml index 8c830da..da7885a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,11 @@ language: go go: - - 1.7.5 - - 1.8.1 + - 1.8.x + - 1.9.x script: - - curl -s https://raw.githubusercontent.com/pote/gpm/v1.4.0/bin/gpm > gpm - - chmod +x gpm - - ./gpm install + - wget -O dep https://github.com/golang/dep/releases/download/v0.3.2/dep-linux-amd64 + - chmod +x dep + - ./dep ensure - ./test.sh sudo: false notifications: diff --git a/Godeps b/Godeps deleted file mode 100644 index f783a27..0000000 --- a/Godeps +++ /dev/null @@ -1,13 +0,0 @@ -github.com/mbland/hmacauth 1.0.2 -github.com/BurntSushi/toml d94612f9fc140360834f9742158c70b5c5b5535b -github.com/bitly/go-simplejson da1a8928f709389522c8023062a3739f3b4af419 -github.com/mreiferson/go-options 77551d20752b54535462404ad9d877ebdb26e53d -github.com/stretchr/testify v1.1.4 -gopkg.in/fsnotify.v1 v1.2.0 -golang.org/x/oauth2 7fdf09982454086d5570c7db3e11f360194830ca -golang.org/x/net/context 242b6b35177ec3909636b6cf6a47e8c2c6324b5d -google.golang.org/api/admin/directory/v1 650535c7d6201e8304c92f38c922a9a3a36c6877 -cloud.google.com/go/compute/metadata v0.7.0 -github.com/coreos/go-oidc c797a55f1c1001ec3169f1d0fbb4c5523563bec6 -gopkg.in/square/go-jose.v2 v2.1.1 -github.com/pquerna/cachecontrol 9299cc36e57c32f83e47ffb3c25d8a3dec10ea0b diff --git a/Gopkg.lock b/Gopkg.lock new file mode 100644 index 0000000..f447496 --- /dev/null +++ b/Gopkg.lock @@ -0,0 +1,117 @@ +# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. + + +[[projects]] + name = "cloud.google.com/go" + packages = ["compute/metadata"] + revision = "2d3a6656c17a60b0815b7e06ab0be04eacb6e613" + version = "v0.16.0" + +[[projects]] + name = "github.com/BurntSushi/toml" + packages = ["."] + revision = "b26d9c308763d68093482582cea63d69be07a0f0" + version = "v0.3.0" + +[[projects]] + name = "github.com/bitly/go-simplejson" + packages = ["."] + revision = "aabad6e819789e569bd6aabf444c935aa9ba1e44" + version = "v0.5.0" + +[[projects]] + branch = "v2" + name = "github.com/coreos/go-oidc" + packages = ["."] + revision = "77e7f2010a464ade7338597afe650dfcffbe2ca8" + +[[projects]] + name = "github.com/davecgh/go-spew" + packages = ["spew"] + revision = "346938d642f2ec3594ed81d874461961cd0faa76" + version = "v1.1.0" + +[[projects]] + branch = "master" + name = "github.com/golang/protobuf" + packages = ["proto"] + revision = "1e59b77b52bf8e4b449a57e6f79f21226d571845" + +[[projects]] + name = "github.com/mbland/hmacauth" + packages = ["."] + revision = "107c17adcc5eccc9935cd67d9bc2feaf5255d2cb" + version = "1.0.2" + +[[projects]] + branch = "master" + name = "github.com/mreiferson/go-options" + packages = ["."] + revision = "77551d20752b54535462404ad9d877ebdb26e53d" + +[[projects]] + name = "github.com/pmezard/go-difflib" + packages = ["difflib"] + revision = "792786c7400a136282c1664665ae0a8db921c6c2" + version = "v1.0.0" + +[[projects]] + branch = "master" + name = "github.com/pquerna/cachecontrol" + packages = [".","cacheobject"] + revision = "0dec1b30a0215bb68605dfc568e8855066c9202d" + +[[projects]] + name = "github.com/stretchr/testify" + packages = ["assert"] + revision = "69483b4bd14f5845b5a1e55bca19e954e827f1d0" + version = "v1.1.4" + +[[projects]] + branch = "master" + name = "golang.org/x/crypto" + packages = ["ed25519","ed25519/internal/edwards25519"] + revision = "9f005a07e0d31d45e6656d241bb5c0f2efd4bc94" + +[[projects]] + branch = "master" + name = "golang.org/x/net" + packages = ["context","context/ctxhttp"] + revision = "9dfe39835686865bff950a07b394c12a98ddc811" + +[[projects]] + branch = "master" + name = "golang.org/x/oauth2" + packages = [".","google","internal","jws","jwt"] + revision = "9ff8ebcc8e241d46f52ecc5bff0e5a2f2dbef402" + +[[projects]] + branch = "master" + name = "google.golang.org/api" + packages = ["admin/directory/v1","gensupport","googleapi","googleapi/internal/uritemplates"] + revision = "8791354e7ab150705ede13637a18c1fcc16b62e8" + +[[projects]] + name = "google.golang.org/appengine" + packages = [".","internal","internal/app_identity","internal/base","internal/datastore","internal/log","internal/modules","internal/remote_api","internal/urlfetch","urlfetch"] + revision = "150dc57a1b433e64154302bdc40b6bb8aefa313a" + version = "v1.0.0" + +[[projects]] + name = "gopkg.in/fsnotify.v1" + packages = ["."] + revision = "836bfd95fecc0f1511dd66bdbf2b5b61ab8b00b6" + version = "v1.2.11" + +[[projects]] + name = "gopkg.in/square/go-jose.v2" + packages = [".","cipher","json"] + revision = "f8f38de21b4dcd69d0413faf231983f5fd6634b1" + version = "v2.1.3" + +[solve-meta] + analyzer-name = "dep" + analyzer-version = 1 + inputs-digest = "efab48a0e196c2a849bfbe9aa02d2ae28d281ce1bfe9f23720d648858eefc8e6" + solver-name = "gps-cdcl" + solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml new file mode 100644 index 0000000..97f83d0 --- /dev/null +++ b/Gopkg.toml @@ -0,0 +1,40 @@ + +# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md +# for detailed Gopkg.toml documentation. +# + +[[constraint]] + name = "github.com/18F/hmacauth" + version = "~1.0.1" + +[[constraint]] + name = "github.com/BurntSushi/toml" + version = "~0.3.0" + +[[constraint]] + name = "github.com/bitly/go-simplejson" + version = "~0.5.0" + +[[constraint]] + branch = "v2" + name = "github.com/coreos/go-oidc" + +[[constraint]] + branch = "master" + name = "github.com/mreiferson/go-options" + +[[constraint]] + name = "github.com/stretchr/testify" + version = "~1.1.4" + +[[constraint]] + branch = "master" + name = "golang.org/x/oauth2" + +[[constraint]] + branch = "master" + name = "google.golang.org/api" + +[[constraint]] + name = "gopkg.in/fsnotify.v1" + version = "~1.2.0" diff --git a/test.sh b/test.sh index ec34366..acc17a2 100755 --- a/test.sh +++ b/test.sh @@ -1,11 +1,14 @@ #!/bin/bash -set -e - +EXIT_CODE=0 echo "gofmt" -diff -u <(echo -n) <(gofmt -d $(find . -type f -name '*.go' -not -path "./.godeps/*")) -echo "go vet" -go vet ./... -echo "go test" -go test -timeout 60s ./... -echo "go test -race" -GOMAXPROCS=4 go test -timeout 60s -race ./... +diff -u <(echo -n) <(gofmt -d $(find . -type f -name '*.go' -not -path "./vendor/*")) || EXIT_CODE=1 +for pkg in $(go list ./... | grep -v '/vendor/' ); do + echo "testing $pkg" + echo "go vet $pkg" + go vet "$pkg" || EXIT_CODE=1 + echo "go test -v $pkg" + go test -v -timeout 90s "$pkg" || EXIT_CODE=1 + echo "go test -v -race $pkg" + GOMAXPROCS=4 go test -v -timeout 90s0s -race "$pkg" || EXIT_CODE=1 +done +exit $EXIT_CODE \ No newline at end of file diff --git a/validator_test.go b/validator_test.go index b87d419..f91f41c 100644 --- a/validator_test.go +++ b/validator_test.go @@ -20,7 +20,7 @@ func NewValidatorTest(t *testing.T) *ValidatorTest { if err != nil { t.Fatal("failed to create temp file: " + err.Error()) } - vt.done = make(chan bool) + vt.done = make(chan bool, 1) return vt } diff --git a/validator_watcher_test.go b/validator_watcher_test.go index 70eaa10..dc16a7d 100644 --- a/validator_watcher_test.go +++ b/validator_watcher_test.go @@ -86,7 +86,7 @@ func TestValidatorOverwriteEmailListViaRenameAndReplace(t *testing.T) { vt.WriteEmails(t, []string{"xyzzy@example.com"}) domains := []string(nil) - updated := make(chan bool) + updated := make(chan bool, 1) validator := vt.NewValidator(domains, updated) if !validator("xyzzy@example.com") {