diff --git a/.travis.yml b/.travis.yml index 30904f1..a3b3b52 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,16 +1,13 @@ language: go go: - - "1.8" - - "1.9" - - "1.10" + - "1.12" -install: - - curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh - - dep ensure +env: + - GO111MODULE=on script: - - go test . -v -coverprofile=coverage.txt -covermode=atomic + - make after_success: - bash <(curl -s https://codecov.io/bash) diff --git a/Gopkg.lock b/Gopkg.lock deleted file mode 100644 index e850bc0..0000000 --- a/Gopkg.lock +++ /dev/null @@ -1,51 +0,0 @@ -# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. - - -[[projects]] - name = "github.com/patrickmn/go-cache" - packages = ["."] - revision = "a3647f8e31d79543b2d0f0ae2fe5c379d72cedc0" - version = "v2.1.0" - -[[projects]] - name = "github.com/square/go-jose" - packages = ["."] - revision = "76dd09796242edb5b897103a75df2645c028c960" - version = "v2.1.6" - -[[projects]] - branch = "master" - name = "golang.org/x/crypto" - packages = [ - "ed25519", - "ed25519/internal/edwards25519" - ] - revision = "a49355c7e3f8fe157a85be2f77e6e269a0f89602" - -[[projects]] - branch = "master" - name = "golang.org/x/net" - packages = ["context"] - revision = "c4299a1a0d8524c11563db160fbf9bddbceadb21" - -[[projects]] - branch = "master" - name = "golang.org/x/sync" - packages = ["semaphore"] - revision = "1d60e4601c6fd243af51cc01ddf169918a5407ca" - -[[projects]] - name = "gopkg.in/square/go-jose.v2" - packages = [ - "cipher", - "json" - ] - revision = "76dd09796242edb5b897103a75df2645c028c960" - version = "v2.1.6" - -[solve-meta] - analyzer-name = "dep" - analyzer-version = 1 - inputs-digest = "4758ac8f902459ec1a3762c604684480bfc6fc4c4b35673d977528dddeb5c9d5" - solver-name = "gps-cdcl" - solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml deleted file mode 100644 index a4462aa..0000000 --- a/Gopkg.toml +++ /dev/null @@ -1,11 +0,0 @@ -[prune] - go-tests = true - unused-packages = true - -[[constraint]] - name = "github.com/square/go-jose" - version = "2.1.6" - -[[constraint]] - name = "github.com/patrickmn/go-cache" - version = "2.1.0" diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..7328e53 --- /dev/null +++ b/Makefile @@ -0,0 +1,8 @@ +.PHONY: all +all: clean test + +clean: + rm -rf ./bin || true + +test: + go test -v ./... -coverprofile=coverage.txt -covermode=atomic diff --git a/README.md b/README.md index af466db..531b84e 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,10 @@ A Go library to retrieve RSA public keys from a JWKS (JSON Web Key Set) endpoint ## Installation +Using [Go modules](https://github.com/golang/go/wiki/Modules) + ```bash -dep ensure --add "github.com/s12v/go-jwks@v0.1.1" +go get github.com/s12v/go-jwks@v0.2.0 ``` ## Dependencies diff --git a/cache.go b/cache.go index 9d49ee9..595e9b9 100644 --- a/cache.go +++ b/cache.go @@ -1,9 +1,9 @@ package jwks import ( + "fmt" "github.com/patrickmn/go-cache" "time" - "fmt" ) type Cache interface { diff --git a/cache_test.go b/cache_test.go index 09ebf69..70e2c00 100644 --- a/cache_test.go +++ b/cache_test.go @@ -1,8 +1,8 @@ package jwks import ( - "testing" "github.com/patrickmn/go-cache" + "testing" "time" ) diff --git a/client.go b/client.go index ac8aa55..2edf375 100644 --- a/client.go +++ b/client.go @@ -4,8 +4,8 @@ import ( "fmt" "github.com/square/go-jose" "golang.org/x/sync/semaphore" - "time" "log" + "time" ) type JWKSClient interface { diff --git a/client_test.go b/client_test.go index 62b3425..3b1a5d8 100644 --- a/client_test.go +++ b/client_test.go @@ -1,8 +1,8 @@ package jwks import ( - "testing" "github.com/square/go-jose" + "testing" "time" ) diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..2915107 --- /dev/null +++ b/go.mod @@ -0,0 +1,12 @@ +module github.com/s12v/go-jwks + +go 1.12 + +require ( + github.com/patrickmn/go-cache v2.1.0+incompatible + github.com/square/go-jose v2.1.6+incompatible + golang.org/x/crypto v0.0.0-20180621125126-a49355c7e3f8 + golang.org/x/net v0.0.0-20180729183719-c4299a1a0d85 + golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f + gopkg.in/square/go-jose.v2 v2.3.1 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..c260941 --- /dev/null +++ b/go.sum @@ -0,0 +1,12 @@ +github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc= +github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= +github.com/square/go-jose v2.1.6+incompatible h1:vlXeaqoFPTA+Q4bWegkZ8PhPq6Ke9np2Bkyi09tMdQc= +github.com/square/go-jose v2.1.6+incompatible/go.mod h1:7MxpAF/1WTVUu8Am+T5kNy+t0902CaLWM4Z745MkOa8= +golang.org/x/crypto v0.0.0-20180621125126-a49355c7e3f8 h1:h7zdf0RiEvWbYBKIx4b+q41xoUVnMmvsGZnIVE5syG8= +golang.org/x/crypto v0.0.0-20180621125126-a49355c7e3f8/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/net v0.0.0-20180729183719-c4299a1a0d85 h1:L8D6kGKB6IflRbLijfnSTkgmss6PZ/Q2MG7XefweZB4= +golang.org/x/net v0.0.0-20180729183719-c4299a1a0d85/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +gopkg.in/square/go-jose.v2 v2.3.1 h1:SK5KegNXmKmqE342YYN2qPHEnUYeoMiXXl1poUlI+o4= +gopkg.in/square/go-jose.v2 v2.3.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= diff --git a/source.go b/source.go index 1eab5fc..489d109 100644 --- a/source.go +++ b/source.go @@ -4,8 +4,8 @@ import ( "encoding/json" "fmt" "github.com/square/go-jose" - "net/http" "log" + "net/http" ) type JWKSSource interface {