From 4ad15bb1fc8bf944e2909c19833bcb6e6525113b Mon Sep 17 00:00:00 2001 From: Burcu Dogan Date: Sun, 20 Jul 2014 21:07:57 -0700 Subject: [PATCH] Remove named return values. --- jwt.go | 5 +++-- oauth2.go | 11 ++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/jwt.go b/jwt.go index ea298f0..40dac3c 100644 --- a/jwt.go +++ b/jwt.go @@ -42,10 +42,11 @@ type JWTOptions struct { // NewJWTConfig creates a new configuration with the specified options // and OAuth2 provider endpoint. -func NewJWTConfig(opts *JWTOptions, aud string) (conf *JWTConfig, err error) { +func NewJWTConfig(opts *JWTOptions, aud string) (*JWTConfig, error) { var audURL *url.URL + var err error if audURL, err = url.Parse(aud); err != nil { - return + return nil, err } contents, err := ioutil.ReadFile(opts.PemFilename) if err != nil { diff --git a/oauth2.go b/oauth2.go index 77d7e27..114c640 100644 --- a/oauth2.go +++ b/oauth2.go @@ -78,19 +78,20 @@ type Options struct { // NewConfig creates a generic OAuth 2.0 configuration that talks // to an OAuth 2.0 provider specified with authURL and tokenURL. -func NewConfig(opts *Options, authURL, tokenURL string) (conf *Config, err error) { +func NewConfig(opts *Options, authURL, tokenURL string) (*Config, error) { var aURL, tURL *url.URL + var err error if aURL, err = url.Parse(authURL); err != nil { - return + return nil, err } if tURL, err = url.Parse(tokenURL); err != nil { - return + return nil, err } - conf = &Config{opts: opts, authURL: aURL, tokenURL: tURL} + conf := &Config{opts: opts, authURL: aURL, tokenURL: tURL} if err = conf.validate(); err != nil { return nil, err } - return + return conf, nil } // Config represents the configuration of an OAuth 2.0 consumer client.