Open platform to collect and prioritize feedback
enhancement: update Go packages (#449)
Guilherme Oenning1a67053caa88
diff --git a/Gopkg.lock b/Gopkg.lockindex 996d90d38..3e1ec9742 100644--- a/Gopkg.lock+++ b/Gopkg.lock@@ -54,7 +54,7 @@".","oid"]- revision = "d34b9ff171c21ad295489235aec8b6626023cd04"+ revision = "90697d60dd844d5ef6ff15135d0203f65d2f53b8"[[projects]]branch = "master"@@ -109,7 +109,7 @@"jws","jwt"]- revision = "6881fee410a5daf86371371f9ad451b95e168b71"+ revision = "ef147856a6ddbb60760db74283d2424e98c87bff"[[projects]]name = "google.golang.org/appengine"diff --git a/vendor/github.com/lib/pq/README.md b/vendor/github.com/lib/pq/README.mdindex 781c89eea..d71f3c2c3 100644--- a/vendor/github.com/lib/pq/README.md+++ b/vendor/github.com/lib/pq/README.md@@ -14,18 +14,7 @@ documentation at <http://godoc.org/github.com/lib/pq>.## Tests-`go test` is used for testing. A running PostgreSQL server is-required, with the ability to log in. The default database to connect-to test with is "pqgotest," but it can be overridden using environment-variables.--Example:-- PGHOST=/run/postgresql go test github.com/lib/pq--Optionally, a benchmark suite can be run as part of the tests:-- PGHOST=/run/postgresql go test -bench .+`go test` is used for testing. See [TESTS.md](TESTS.md) for more details.## Featuresdiff --git a/vendor/github.com/lib/pq/TESTS.md b/vendor/github.com/lib/pq/TESTS.mdnew file mode 100644index 000000000..f05021115--- /dev/null+++ b/vendor/github.com/lib/pq/TESTS.md@@ -0,0 +1,33 @@+# Tests++## Running Tests++`go test` is used for testing. A running PostgreSQL+server is required, with the ability to log in. The+database to connect to test with is "pqgotest," on+"localhost" but these can be overridden using [environment+variables](https://www.postgresql.org/docs/9.3/static/libpq-envars.html).++Example:++ PGHOST=/run/postgresql go test++## Benchmarks++A benchmark suite can be run as part of the tests:++ go test -bench .++## Example setup (Docker)++Run a postgres container:++```+docker run --expose 5432:5432 postgres+```++Run tests:++```+PGHOST=localhost PGPORT=5432 PGUSER=postgres PGSSLMODE=disable PGDATABASE=postgres go test+```diff --git a/vendor/github.com/lib/pq/connector.go b/vendor/github.com/lib/pq/connector.gonew file mode 100644index 000000000..9e66eb5df--- /dev/null+++ b/vendor/github.com/lib/pq/connector.go@@ -0,0 +1,43 @@+// +build go1.10++package pq++import (+ "context"+ "database/sql/driver"+)++// Connector represents a fixed configuration for the pq driver with a given+// name. Connector satisfies the database/sql/driver Connector interface and+// can be used to create any number of DB Conn's via the database/sql OpenDB+// function.+//+// See https://golang.org/pkg/database/sql/driver/#Connector.+// See https://golang.org/pkg/database/sql/#OpenDB.+type connector struct {+ name string+}++// Connect returns a connection to the database using the fixed configuration+// of this Connector. Context is not used.+func (c *connector) Connect(_ context.Context) (driver.Conn, error) {+ return (&Driver{}).Open(c.name)+}++// Driver returnst the underlying driver of this Connector.+func (c *connector) Driver() driver.Driver {+ return &Driver{}+}++var _ driver.Connector = &connector{}++// NewConnector returns a connector for the pq driver in a fixed configuration+// with the given name. The returned connector can be used to create any number+// of equivalent Conn's. The returned connector is intended to be used with+// database/sql.OpenDB.+//+// See https://golang.org/pkg/database/sql/driver/#Connector.+// See https://golang.org/pkg/database/sql/#OpenDB.+func NewConnector(name string) (driver.Connector, error) {+ return &connector{name: name}, nil+}diff --git a/vendor/github.com/lib/pq/connector_example_test.go b/vendor/github.com/lib/pq/connector_example_test.gonew file mode 100644index 000000000..5b66cf4ba--- /dev/null+++ b/vendor/github.com/lib/pq/connector_example_test.go@@ -0,0 +1,33 @@+// +build go1.10++package pq_test++import (+ "database/sql"+ "fmt"++ "github.com/lib/pq"+)++func ExampleNewConnector() {+ name := ""+ connector, err := pq.NewConnector(name)+ if err != nil {+ fmt.Println(err)+ return+ }+ db := sql.OpenDB(connector)+ if err != nil {+ fmt.Println(err)+ return+ }+ defer db.Close()++ // Use the DB+ txn, err := db.Begin()+ if err != nil {+ fmt.Println(err)+ return+ }+ txn.Rollback()+}diff --git a/vendor/github.com/lib/pq/connector_test.go b/vendor/github.com/lib/pq/connector_test.gonew file mode 100644index 000000000..3d2c67b06--- /dev/null+++ b/vendor/github.com/lib/pq/connector_test.go@@ -0,0 +1,67 @@+// +build go1.10++package pq++import (+ "context"+ "database/sql"+ "database/sql/driver"+ "testing"+)++func TestNewConnector_WorksWithOpenDB(t *testing.T) {+ name := ""+ c, err := NewConnector(name)+ if err != nil {+ t.Fatal(err)+ }+ db := sql.OpenDB(c)+ defer db.Close()+ // database/sql might not call our Open at all unless we do something with+ // the connection+ txn, err := db.Begin()+ if err != nil {+ t.Fatal(err)+ }+ txn.Rollback()+}++func TestNewConnector_Connect(t *testing.T) {+ name := ""+ c, err := NewConnector(name)+ if err != nil {+ t.Fatal(err)+ }+ db, err := c.Connect(context.Background())+ if err != nil {+ t.Fatal(err)+ }+ defer db.Close()+ // database/sql might not call our Open at all unless we do something with+ // the connection+ txn, err := db.(driver.ConnBeginTx).BeginTx(context.Background(), driver.TxOptions{})+ if err != nil {+ t.Fatal(err)+ }+ txn.Rollback()+}++func TestNewConnector_Driver(t *testing.T) {+ name := ""+ c, err := NewConnector(name)+ if err != nil {+ t.Fatal(err)+ }+ db, err := c.Driver().Open(name)+ if err != nil {+ t.Fatal(err)+ }+ defer db.Close()+ // database/sql might not call our Open at all unless we do something with+ // the connection+ txn, err := db.(driver.ConnBeginTx).BeginTx(context.Background(), driver.TxOptions{})+ if err != nil {+ t.Fatal(err)+ }+ txn.Rollback()+}diff --git a/vendor/golang.org/x/oauth2/cern/cern.go b/vendor/golang.org/x/oauth2/cern/cern.gonew file mode 100644index 000000000..8be718078--- /dev/null+++ b/vendor/golang.org/x/oauth2/cern/cern.go@@ -0,0 +1,16 @@+// Copyright 2018 The Go Authors. All rights reserved.+// Use of this source code is governed by a BSD-style+// license that can be found in the LICENSE file.++// Package cern provides constants for using OAuth2 to access CERN services.+package cern // import "golang.org/x/oauth2/cern"++import (+ "golang.org/x/oauth2"+)++// Endpoint is CERN's OAuth 2.0 endpoint.+var Endpoint = oauth2.Endpoint{+ AuthURL: "https://oauth.web.cern.ch/OAuth/Authorize",+ TokenURL: "https://oauth.web.cern.ch/OAuth/Token",+}diff --git a/vendor/golang.org/x/oauth2/gitlab/gitlab.go b/vendor/golang.org/x/oauth2/gitlab/gitlab.gonew file mode 100644index 000000000..1231d75ac--- /dev/null+++ b/vendor/golang.org/x/oauth2/gitlab/gitlab.go@@ -0,0 +1,16 @@+// Copyright 2018 The Go Authors. All rights reserved.+// Use of this source code is governed by a BSD-style+// license that can be found in the LICENSE file.++// Package gitlab provides constants for using OAuth2 to access GitLab.+package gitlab // import "golang.org/x/oauth2/gitlab"++import (+ "golang.org/x/oauth2"+)++// Endpoint is GitLab's OAuth 2.0 endpoint.+var Endpoint = oauth2.Endpoint{+ AuthURL: "https://gitlab.com/oauth/authorize",+ TokenURL: "https://gitlab.com/oauth/token",+}diff --git a/vendor/golang.org/x/oauth2/internal/token.go b/vendor/golang.org/x/oauth2/internal/token.goindex 30fb315d1..999e668e6 100644--- a/vendor/golang.org/x/oauth2/internal/token.go+++ b/vendor/golang.org/x/oauth2/internal/token.go@@ -101,6 +101,7 @@ var brokenAuthHeaderProviders = []string{"https://api.pushbullet.com/","https://api.soundcloud.com/","https://api.twitch.tv/",+ "https://id.twitch.tv/","https://app.box.com/","https://connect.stripe.com/","https://login.mailchimp.com/",@@ -128,6 +129,7 @@ var brokenAuthHeaderProviders = []string{"https://log.finalsurge.com/oauth/token","https://multisport.todaysplan.com.au/rest/oauth/access_token","https://whats.todaysplan.com.au/rest/oauth/access_token",+ "https://stackoverflow.com/oauth/access_token",}// brokenAuthHeaderDomains lists broken providers that issue dynamic endpoints.diff --git a/vendor/golang.org/x/oauth2/jira/jira.go b/vendor/golang.org/x/oauth2/jira/jira.goindex e8021e9d3..34415607c 100644--- a/vendor/golang.org/x/oauth2/jira/jira.go+++ b/vendor/golang.org/x/oauth2/jira/jira.go@@ -94,8 +94,8 @@ func (js jwtSource) Token() (*oauth2.Token, error) {// Add scopes if they exist; If not, it defaults to app scopesif scopes := js.conf.Scopes; scopes != nil {upperScopes := make([]string, len(scopes))- for _, k := range scopes {- upperScopes = append(upperScopes, strings.ToUpper(k))+ for i, k := range scopes {+ upperScopes[i] = strings.ToUpper(k)}v.Set("scope", strings.Join(upperScopes, "+"))}diff --git a/vendor/golang.org/x/oauth2/kakao/kakao.go b/vendor/golang.org/x/oauth2/kakao/kakao.gonew file mode 100644index 000000000..6d211260c--- /dev/null+++ b/vendor/golang.org/x/oauth2/kakao/kakao.go@@ -0,0 +1,16 @@+// Copyright 2018 The Go Authors. All rights reserved.+// Use of this source code is governed by a BSD-style+// license that can be found in the LICENSE file.++// Package kakao provides constants for using OAuth2 to access Kakao.+package kakao // import "golang.org/x/oauth2/kakao"++import (+ "golang.org/x/oauth2"+)++// Endpoint is Kakao's OAuth 2.0 endpoint.+var Endpoint = oauth2.Endpoint{+ AuthURL: "https://kauth.kakao.com/oauth/authorize",+ TokenURL: "https://kauth.kakao.com/oauth/token",+}diff --git a/vendor/golang.org/x/oauth2/linkedin/linkedin.go b/vendor/golang.org/x/oauth2/linkedin/linkedin.goindex b619f93d2..62d1de817 100644--- a/vendor/golang.org/x/oauth2/linkedin/linkedin.go+++ b/vendor/golang.org/x/oauth2/linkedin/linkedin.go@@ -11,6 +11,6 @@ import (// Endpoint is LinkedIn's OAuth 2.0 endpoint.var Endpoint = oauth2.Endpoint{- AuthURL: "https://www.linkedin.com/uas/oauth2/authorization",- TokenURL: "https://www.linkedin.com/uas/oauth2/accessToken",+ AuthURL: "https://www.linkedin.com/oauth/v2/authorization",+ TokenURL: "https://www.linkedin.com/oauth/v2/accessToken",}diff --git a/vendor/golang.org/x/oauth2/oauth2.go b/vendor/golang.org/x/oauth2/oauth2.goindex a047a5f98..16775d081 100644--- a/vendor/golang.org/x/oauth2/oauth2.go+++ b/vendor/golang.org/x/oauth2/oauth2.go@@ -3,7 +3,8 @@// license that can be found in the LICENSE file.// Package oauth2 provides support for making-// OAuth2 authorized and authenticated HTTP requests.+// OAuth2 authorized and authenticated HTTP requests,+// as specified in RFC 6749.// It can additionally grant authorization with Bearer JWT.package oauth2 // import "golang.org/x/oauth2"@@ -123,6 +124,8 @@ func SetAuthURLParam(key, value string) AuthCodeOption {//// Opts may include AccessTypeOnline or AccessTypeOffline, as well// as ApprovalForce.+// It can also be used to pass the PKCE challange.+// See https://www.oauth.com/oauth2-servers/pkce/ for more info.func (c *Config) AuthCodeURL(state string, opts ...AuthCodeOption) string {var buf bytes.Bufferbuf.WriteString(c.Endpoint.AuthURL)@@ -185,7 +188,10 @@ func (c *Config) PasswordCredentialsToken(ctx context.Context, username, passwor//// The code will be in the *http.Request.FormValue("code"). Before// calling Exchange, be sure to validate FormValue("state").-func (c *Config) Exchange(ctx context.Context, code string) (*Token, error) {+//+// Opts may include the PKCE verifier code if previously used in AuthCodeURL.+// See https://www.oauth.com/oauth2-servers/pkce/ for more info.+func (c *Config) Exchange(ctx context.Context, code string, opts ...AuthCodeOption) (*Token, error) {v := url.Values{"grant_type": {"authorization_code"},"code": {code},@@ -193,6 +199,9 @@ func (c *Config) Exchange(ctx context.Context, code string) (*Token, error) {if c.RedirectURL != "" {v.Set("redirect_uri", c.RedirectURL)}+ for _, opt := range opts {+ opt.setValue(v)+ }return retrieveToken(ctx, c, v)}diff --git a/vendor/golang.org/x/oauth2/oauth2_test.go b/vendor/golang.org/x/oauth2/oauth2_test.goindex 847160f91..ef12ebc57 100644--- a/vendor/golang.org/x/oauth2/oauth2_test.go+++ b/vendor/golang.org/x/oauth2/oauth2_test.go@@ -135,6 +135,52 @@ func TestExchangeRequest(t *testing.T) {}}+func TestExchangeRequest_CustomParam(t *testing.T) {+ ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {+ if r.URL.String() != "/token" {+ t.Errorf("Unexpected exchange request URL, %v is found.", r.URL)+ }+ headerAuth := r.Header.Get("Authorization")+ if headerAuth != "Basic Q0xJRU5UX0lEOkNMSUVOVF9TRUNSRVQ=" {+ t.Errorf("Unexpected authorization header, %v is found.", headerAuth)+ }+ headerContentType := r.Header.Get("Content-Type")+ if headerContentType != "application/x-www-form-urlencoded" {+ t.Errorf("Unexpected Content-Type header, %v is found.", headerContentType)+ }+ body, err := ioutil.ReadAll(r.Body)+ if err != nil {+ t.Errorf("Failed reading request body: %s.", err)+ }+ if string(body) != "code=exchange-code&foo=bar&grant_type=authorization_code&redirect_uri=REDIRECT_URL" {+ t.Errorf("Unexpected exchange payload, %v is found.", string(body))+ }+ w.Header().Set("Content-Type", "application/x-www-form-urlencoded")+ w.Write([]byte("access_token=90d64460d14870c08c81352a05dedd3465940a7c&scope=user&token_type=bearer"))+ }))+ defer ts.Close()+ conf := newConf(ts.URL)++ param := SetAuthURLParam("foo", "bar")+ tok, err := conf.Exchange(context.Background(), "exchange-code", param)+ if err != nil {+ t.Error(err)+ }+ if !tok.Valid() {+ t.Fatalf("Token invalid. Got: %#v", tok)+ }+ if tok.AccessToken != "90d64460d14870c08c81352a05dedd3465940a7c" {+ t.Errorf("Unexpected access token, %#v.", tok.AccessToken)+ }+ if tok.TokenType != "bearer" {+ t.Errorf("Unexpected token type, %#v.", tok.TokenType)+ }+ scope := tok.Extra("scope")+ if scope != "user" {+ t.Errorf("Unexpected value for scope: %v", scope)+ }+}+func TestExchangeRequest_JSONResponse(t *testing.T) {ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {if r.URL.String() != "/token" {diff --git a/vendor/golang.org/x/oauth2/stackoverflow/stackoverflow.go b/vendor/golang.org/x/oauth2/stackoverflow/stackoverflow.gonew file mode 100644index 000000000..82711f777--- /dev/null+++ b/vendor/golang.org/x/oauth2/stackoverflow/stackoverflow.go@@ -0,0 +1,16 @@+// Copyright 2018 The Go Authors. All rights reserved.+// Use of this source code is governed by a BSD-style+// license that can be found in the LICENSE file.++// Package stackoverflow provides constants for using OAuth2 to access Stack Overflow.+package stackoverflow // import "golang.org/x/oauth2/stackoverflow"++import (+ "golang.org/x/oauth2"+)++// Endpoint is Stack Overflow's OAuth 2.0 endpoint.+var Endpoint = oauth2.Endpoint{+ AuthURL: "https://stackoverflow.com/oauth",+ TokenURL: "https://stackoverflow.com/oauth/access_token",+}diff --git a/vendor/golang.org/x/oauth2/transport.go b/vendor/golang.org/x/oauth2/transport.goindex 92ac7e253..aa0d34f1e 100644--- a/vendor/golang.org/x/oauth2/transport.go+++ b/vendor/golang.org/x/oauth2/transport.go@@ -31,9 +31,17 @@ type Transport struct {}// RoundTrip authorizes and authenticates the request with an-// access token. If no token exists or token is expired,-// tries to refresh/fetch a new token.+// access token from Transport's Source.func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error) {+ reqBodyClosed := false+ if req.Body != nil {+ defer func() {+ if !reqBodyClosed {+ req.Body.Close()+ }+ }()+ }+if t.Source == nil {return nil, errors.New("oauth2: Transport's Source is nil")}@@ -46,6 +54,10 @@ func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error) {token.SetAuthHeader(req2)t.setModReq(req, req2)res, err := t.base().RoundTrip(req2)++ // req.Body is assumed to have been closed by the base RoundTripper.+ reqBodyClosed = true+if err != nil {t.setModReq(req, nil)return nil, errdiff --git a/vendor/golang.org/x/oauth2/transport_test.go b/vendor/golang.org/x/oauth2/transport_test.goindex d6e8087d6..faa87d514 100644--- a/vendor/golang.org/x/oauth2/transport_test.go+++ b/vendor/golang.org/x/oauth2/transport_test.go@@ -1,6 +1,8 @@package oauth2import (+ "errors"+ "io""net/http""net/http/httptest""testing"@@ -27,6 +29,64 @@ func TestTransportNilTokenSource(t *testing.T) {}}+type readCloseCounter struct {+ CloseCount int+ ReadErr error+}++func (r *readCloseCounter) Read(b []byte) (int, error) {+ return 0, r.ReadErr+}++func (r *readCloseCounter) Close() error {+ r.CloseCount+++ return nil+}++func TestTransportCloseRequestBody(t *testing.T) {+ tr := &Transport{}+ server := newMockServer(func(w http.ResponseWriter, r *http.Request) {})+ defer server.Close()+ client := &http.Client{Transport: tr}+ body := &readCloseCounter{+ ReadErr: errors.New("readCloseCounter.Read not implemented"),+ }+ resp, err := client.Post(server.URL, "application/json", body)+ if err == nil {+ t.Errorf("got no errors, want an error with nil token source")+ }+ if resp != nil {+ t.Errorf("Response = %v; want nil", resp)+ }+ if expected := 1; body.CloseCount != expected {+ t.Errorf("Body was closed %d times, expected %d", body.CloseCount, expected)+ }+}++func TestTransportCloseRequestBodySuccess(t *testing.T) {+ tr := &Transport{+ Source: StaticTokenSource(&Token{+ AccessToken: "abc",+ }),+ }+ server := newMockServer(func(w http.ResponseWriter, r *http.Request) {})+ defer server.Close()+ client := &http.Client{Transport: tr}+ body := &readCloseCounter{+ ReadErr: io.EOF,+ }+ resp, err := client.Post(server.URL, "application/json", body)+ if err != nil {+ t.Errorf("got error %v; expected none", err)+ }+ if resp == nil {+ t.Errorf("Response is nil; expected non-nil")+ }+ if expected := 1; body.CloseCount != expected {+ t.Errorf("Body was closed %d times, expected %d", body.CloseCount, expected)+ }+}+func TestTransportTokenSource(t *testing.T) {ts := &tokenSource{token: &Token{diff --git a/vendor/golang.org/x/oauth2/twitch/twitch.go b/vendor/golang.org/x/oauth2/twitch/twitch.goindex 8c5f06aae..0838e7c15 100644--- a/vendor/golang.org/x/oauth2/twitch/twitch.go+++ b/vendor/golang.org/x/oauth2/twitch/twitch.go@@ -14,6 +14,6 @@ import (// For more information see:// https://dev.twitch.tv/docs/authenticationvar Endpoint = oauth2.Endpoint{- AuthURL: "https://api.twitch.tv/kraken/oauth2/authorize",- TokenURL: "https://api.twitch.tv/kraken/oauth2/token",+ AuthURL: "https://id.twitch.tv/oauth2/authorize",+ TokenURL: "https://id.twitch.tv/oauth2/token",}