Skip to content
This repository was archived by the owner on Jan 24, 2019. It is now read-only.

Commit bb9b607

Browse files
authored
Merge pull request #361 from jehiah/gofmt_361
travis: run gofmt and go vet
2 parents 4464655 + c5fc7ba commit bb9b607

5 files changed

Lines changed: 20 additions & 14 deletions

File tree

oauthproxy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ func NewOAuthProxy(opts *Options, validator func(string) bool) *OAuthProxy {
199199
skipAuthRegex: opts.SkipAuthRegex,
200200
compiledRegex: opts.CompiledRegex,
201201
PassBasicAuth: opts.PassBasicAuth,
202-
PassUserHeaders: opts.PassUserHeaders,
202+
PassUserHeaders: opts.PassUserHeaders,
203203
BasicAuthPassword: opts.BasicAuthPassword,
204204
PassAccessToken: opts.PassAccessToken,
205205
SkipProviderButton: opts.SkipProviderButton,

options.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ type Options struct {
5454
PassAccessToken bool `flag:"pass-access-token" cfg:"pass_access_token"`
5555
PassHostHeader bool `flag:"pass-host-header" cfg:"pass_host_header"`
5656
SkipProviderButton bool `flag:"skip-provider-button" cfg:"skip_provider_button"`
57-
PassUserHeaders bool `flag:"pass-user-headers" cfg:"pass_user_headers"`
57+
PassUserHeaders bool `flag:"pass-user-headers" cfg:"pass_user_headers"`
5858

5959
// These options allow for other providers besides Google, with
6060
// potential overrides.

providers/azure.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ package providers
33
import (
44
"errors"
55
"fmt"
6+
"github.com/bitly/go-simplejson"
67
"github.com/bitly/oauth2_proxy/api"
78
"log"
89
"net/http"
910
"net/url"
10-
"github.com/bitly/go-simplejson"
1111
)
1212

1313
type AzureProvider struct {
@@ -67,26 +67,26 @@ func getAzureHeader(access_token string) http.Header {
6767
}
6868

6969
func getEmailFromJSON(json *simplejson.Json) (string, error) {
70-
var email string
70+
var email string
7171
var err error
72-
72+
7373
email, err = json.Get("mail").String()
74-
74+
7575
if err != nil || email == "" {
7676
otherMails, otherMailsErr := json.Get("otherMails").Array()
77-
if len(otherMails) > 0{
77+
if len(otherMails) > 0 {
7878
email = otherMails[0].(string)
7979
}
8080
err = otherMailsErr
8181
}
82-
82+
8383
return email, err
84-
}
84+
}
8585

8686
func (p *AzureProvider) GetEmailAddress(s *SessionState) (string, error) {
8787
var email string
8888
var err error
89-
89+
9090
if s.AccessToken == "" {
9191
return "", errors.New("missing access token")
9292
}
@@ -109,16 +109,16 @@ func (p *AzureProvider) GetEmailAddress(s *SessionState) (string, error) {
109109
}
110110

111111
email, err = json.Get("userPrincipalName").String()
112-
112+
113113
if err != nil {
114114
log.Printf("failed making request %s", err)
115115
return "", err
116116
}
117-
117+
118118
if email == "" {
119119
log.Printf("failed to get email address")
120120
return "", err
121121
}
122-
122+
123123
return email, err
124124
}

providers/azure_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,4 +197,4 @@ func TestAzureProviderGetEmailAddressIncorrectOtherMails(t *testing.T) {
197197
email, err := p.GetEmailAddress(session)
198198
assert.Equal(t, "type assertion to string failed", err.Error())
199199
assert.Equal(t, "", email)
200-
}
200+
}

test.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
#!/bin/bash
22
set -e
33

4+
echo "gofmt"
5+
diff -u <(echo -n) <(gofmt -d $(find . -type f -name '*.go' -not -path "./.godeps/*"))
6+
echo "go vet"
7+
go vet ./...
8+
echo "go test"
49
go test -timeout 60s ./...
10+
echo "go test -race"
511
GOMAXPROCS=4 go test -timeout 60s -race ./...

0 commit comments

Comments
 (0)