Skip to content

Commit b1cfb79

Browse files
committed
fix some minor lint / style errors
1 parent f33bc82 commit b1cfb79

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

schema.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -100,31 +100,31 @@ func (r *AuthnRequest) Element() *etree.Element {
100100
}
101101

102102
// MarshalXML implements xml.Marshaler
103-
func (a *AuthnRequest) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
103+
func (r *AuthnRequest) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
104104
type Alias AuthnRequest
105105
aux := &struct {
106106
IssueInstant RelaxedTime `xml:",attr"`
107107
*Alias
108108
}{
109-
IssueInstant: RelaxedTime(a.IssueInstant),
110-
Alias: (*Alias)(a),
109+
IssueInstant: RelaxedTime(r.IssueInstant),
110+
Alias: (*Alias)(r),
111111
}
112112
return e.Encode(aux)
113113
}
114114

115115
// UnmarshalXML implements xml.Unmarshaler
116-
func (a *AuthnRequest) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
116+
func (r *AuthnRequest) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
117117
type Alias AuthnRequest
118118
aux := &struct {
119119
IssueInstant RelaxedTime `xml:",attr"`
120120
*Alias
121121
}{
122-
Alias: (*Alias)(a),
122+
Alias: (*Alias)(r),
123123
}
124124
if err := d.DecodeElement(&aux, &start); err != nil {
125125
return err
126126
}
127-
a.IssueInstant = time.Time(aux.IssueInstant)
127+
r.IssueInstant = time.Time(aux.IssueInstant)
128128
return nil
129129
}
130130

service_provider.go

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
// NameIDFormat is the format of the id
2626
type NameIDFormat string
2727

28+
// Element returns an XML element representation of n.
2829
func (n NameIDFormat) Element() *etree.Element {
2930
el := etree.NewElement("")
3031
el.SetText(string(n))

time.go

+4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@ package saml
22

33
import "time"
44

5+
// RelaxedTime is a version of time.Time that supports the time format
6+
// found in SAML documents.
57
type RelaxedTime time.Time
68

79
const timeFormat = "2006-01-02T15:04:05.999Z07:00"
810

11+
// MarshalText implements encoding.TextMarshaler
912
func (m RelaxedTime) MarshalText() ([]byte, error) {
1013
// According to section 1.2.2 of the OASIS SAML 1.1 spec, we can't trust
1114
// other applications to handle time resolution finer than a millisecond.
@@ -18,6 +21,7 @@ func (m RelaxedTime) String() string {
1821
return time.Time(m).Round(time.Millisecond).UTC().Format(timeFormat)
1922
}
2023

24+
// UnmarshalText implements encoding.TextUnmarshaler
2125
func (m *RelaxedTime) UnmarshalText(text []byte) error {
2226
if len(text) == 0 {
2327
*m = RelaxedTime(time.Time{})

0 commit comments

Comments
 (0)