Skip to content

Commit a79fb6b

Browse files
authored
Lint/gofmt fixes. (#418)
* Lint/gofmt fixes. Lint checks now pass. * Additional gofmt fix required for go1.19
1 parent d16fb56 commit a79fb6b

File tree

12 files changed

+40
-22
lines changed

12 files changed

+40
-22
lines changed

control.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const (
2020
ControlTypeManageDsaIT = "2.16.840.1.113730.3.4.2"
2121
// ControlTypeWhoAmI - https://tools.ietf.org/html/rfc4532
2222
ControlTypeWhoAmI = "1.3.6.1.4.1.4203.1.11.3"
23-
// ControlTypeSubTreeDelete - https://datatracker.ietf.org/doc/html/draft-armijo-ldap-treedelete-02
23+
// ControlTypeSubtreeDelete - https://datatracker.ietf.org/doc/html/draft-armijo-ldap-treedelete-02
2424
ControlTypeSubtreeDelete = "1.2.840.113556.1.4.805"
2525

2626
// ControlTypeMicrosoftNotification - https://msdn.microsoft.com/en-us/library/aa366983(v=vs.85).aspx
@@ -232,7 +232,7 @@ func (c *ControlManageDsaIT) GetControlType() string {
232232

233233
// Encode returns the ber packet representation
234234
func (c *ControlManageDsaIT) Encode() *ber.Packet {
235-
//FIXME
235+
// FIXME
236236
packet := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "Control")
237237
packet.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, ControlTypeManageDsaIT, "Control Type ("+ControlTypeMap[ControlTypeManageDsaIT]+")"))
238238
if c.Criticality {
@@ -439,18 +439,18 @@ func DecodeControl(packet *ber.Packet) (Control, error) {
439439

440440
for _, child := range sequence.Children {
441441
if child.Tag == 0 {
442-
//Warning
442+
// Warning
443443
warningPacket := child.Children[0]
444444
val, err := ber.ParseInt64(warningPacket.Data.Bytes())
445445
if err != nil {
446446
return nil, fmt.Errorf("failed to decode data bytes: %s", err)
447447
}
448448
if warningPacket.Tag == 0 {
449-
//timeBeforeExpiration
449+
// timeBeforeExpiration
450450
c.Expire = val
451451
warningPacket.Value = c.Expire
452452
} else if warningPacket.Tag == 1 {
453-
//graceAuthNsRemaining
453+
// graceAuthNsRemaining
454454
c.Grace = val
455455
warningPacket.Value = c.Grace
456456
}
@@ -524,16 +524,21 @@ func NewControlBeheraPasswordPolicy() *ControlBeheraPasswordPolicy {
524524
}
525525
}
526526

527+
// ControlSubtreeDelete implements the subtree delete control described in
528+
// https://datatracker.ietf.org/doc/html/draft-armijo-ldap-treedelete-02
527529
type ControlSubtreeDelete struct{}
528530

531+
// GetControlType returns the OID
529532
func (c *ControlSubtreeDelete) GetControlType() string {
530533
return ControlTypeSubtreeDelete
531534
}
532535

536+
// NewControlSubtreeDelete returns a ControlSubtreeDelete control.
533537
func NewControlSubtreeDelete() *ControlSubtreeDelete {
534538
return &ControlSubtreeDelete{}
535539
}
536540

541+
// Encode returns the ber packet representation
537542
func (c *ControlSubtreeDelete) Encode() *ber.Packet {
538543
packet := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "Control")
539544
packet.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, ControlTypeSubtreeDelete, "Control Type ("+ControlTypeMap[ControlTypeSubtreeDelete]+")"))

debug.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
)
66

77
// debugging type
8-
// - has a Printf method to write the debug output
8+
// - has a Printf method to write the debug output
99
type debugging bool
1010

1111
// Enable controls debugging mode.

dn.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ func (a *AttributeTypeAndValue) Equal(other *AttributeTypeAndValue) bool {
286286
return strings.EqualFold(a.Type, other.Type) && a.Value == other.Value
287287
}
288288

289-
// Equal returns true if the DNs are equal as defined by rfc4517 4.2.15 (distinguishedNameMatch).
289+
// EqualFold returns true if the DNs are equal as defined by rfc4517 4.2.15 (distinguishedNameMatch).
290290
// Returns true if they have the same number of relative distinguished names
291291
// and corresponding relative distinguished names (by position) are the same.
292292
// Case of the attribute type and value is not significant
@@ -318,7 +318,7 @@ func (d *DN) AncestorOfFold(other *DN) bool {
318318
return true
319319
}
320320

321-
// Equal returns true if the RelativeDNs are equal as defined by rfc4517 4.2.15 (distinguishedNameMatch).
321+
// EqualFold returns true if the RelativeDNs are equal as defined by rfc4517 4.2.15 (distinguishedNameMatch).
322322
// Case of the attribute type is not significant
323323
func (r *RelativeDN) EqualFold(other *RelativeDN) bool {
324324
if len(r.Attributes) != len(other.Attributes) {

moddn.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ type ModifyDNRequest struct {
2323
// RDN of the given DN.
2424
//
2525
// A call like
26-
// mdnReq := NewModifyDNRequest("uid=someone,dc=example,dc=org", "uid=newname", true, "")
26+
//
27+
// mdnReq := NewModifyDNRequest("uid=someone,dc=example,dc=org", "uid=newname", true, "")
28+
//
2729
// will setup the request to just rename uid=someone,dc=example,dc=org to
2830
// uid=newname,dc=example,dc=org.
2931
func NewModifyDNRequest(dn string, rdn string, delOld bool, newSup string) *ModifyDNRequest {
@@ -40,7 +42,7 @@ func NewModifyDNRequest(dn string, rdn string, delOld bool, newSup string) *Modi
4042
//
4143
// Refer NewModifyDNRequest for other parameters
4244
func NewModifyDNWithControlsRequest(dn string, rdn string, delOld bool,
43-
newSup string, controls []Control) *ModifyDNRequest {
45+
newSup string, controls []Control) *ModifyDNRequest {
4446
return &ModifyDNRequest{
4547
DN: dn,
4648
NewRDN: rdn,

request.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ import (
99
var (
1010
errRespChanClosed = errors.New("ldap: response channel closed")
1111
errCouldNotRetMsg = errors.New("ldap: could not retrieve message")
12-
ErrNilConnection = errors.New("ldap: conn is nil, expected net.Conn")
12+
// ErrNilConnection is returned if doRequest is called with a nil connection.
13+
ErrNilConnection = errors.New("ldap: conn is nil, expected net.Conn")
1314
)
1415

1516
type request interface {

unbind.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
ber "github.com/go-asn1-ber/asn1-ber"
77
)
88

9+
// ErrConnUnbound is returned when Unbind is called on an already closing connection.
910
var ErrConnUnbound = NewError(ErrorNetwork, errors.New("ldap: connection is closed"))
1011

1112
type unbindRequest struct{}

v3/control.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const (
2020
ControlTypeManageDsaIT = "2.16.840.1.113730.3.4.2"
2121
// ControlTypeWhoAmI - https://tools.ietf.org/html/rfc4532
2222
ControlTypeWhoAmI = "1.3.6.1.4.1.4203.1.11.3"
23-
// ControlTypeSubTreeDelete - https://datatracker.ietf.org/doc/html/draft-armijo-ldap-treedelete-02
23+
// ControlTypeSubtreeDelete - https://datatracker.ietf.org/doc/html/draft-armijo-ldap-treedelete-02
2424
ControlTypeSubtreeDelete = "1.2.840.113556.1.4.805"
2525

2626
// ControlTypeMicrosoftNotification - https://msdn.microsoft.com/en-us/library/aa366983(v=vs.85).aspx
@@ -232,7 +232,7 @@ func (c *ControlManageDsaIT) GetControlType() string {
232232

233233
// Encode returns the ber packet representation
234234
func (c *ControlManageDsaIT) Encode() *ber.Packet {
235-
//FIXME
235+
// FIXME
236236
packet := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "Control")
237237
packet.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, ControlTypeManageDsaIT, "Control Type ("+ControlTypeMap[ControlTypeManageDsaIT]+")"))
238238
if c.Criticality {
@@ -439,18 +439,18 @@ func DecodeControl(packet *ber.Packet) (Control, error) {
439439

440440
for _, child := range sequence.Children {
441441
if child.Tag == 0 {
442-
//Warning
442+
// Warning
443443
warningPacket := child.Children[0]
444444
val, err := ber.ParseInt64(warningPacket.Data.Bytes())
445445
if err != nil {
446446
return nil, fmt.Errorf("failed to decode data bytes: %s", err)
447447
}
448448
if warningPacket.Tag == 0 {
449-
//timeBeforeExpiration
449+
// timeBeforeExpiration
450450
c.Expire = val
451451
warningPacket.Value = c.Expire
452452
} else if warningPacket.Tag == 1 {
453-
//graceAuthNsRemaining
453+
// graceAuthNsRemaining
454454
c.Grace = val
455455
warningPacket.Value = c.Grace
456456
}
@@ -524,16 +524,21 @@ func NewControlBeheraPasswordPolicy() *ControlBeheraPasswordPolicy {
524524
}
525525
}
526526

527+
// ControlSubtreeDelete implements the subtree delete control described in
528+
// https://datatracker.ietf.org/doc/html/draft-armijo-ldap-treedelete-02
527529
type ControlSubtreeDelete struct{}
528530

531+
// GetControlType returns the OID
529532
func (c *ControlSubtreeDelete) GetControlType() string {
530533
return ControlTypeSubtreeDelete
531534
}
532535

536+
// NewControlSubtreeDelete returns a ControlSubtreeDelete control.
533537
func NewControlSubtreeDelete() *ControlSubtreeDelete {
534538
return &ControlSubtreeDelete{}
535539
}
536540

541+
// Encode returns the ber packet representation
537542
func (c *ControlSubtreeDelete) Encode() *ber.Packet {
538543
packet := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "Control")
539544
packet.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, ControlTypeSubtreeDelete, "Control Type ("+ControlTypeMap[ControlTypeSubtreeDelete]+")"))

v3/debug.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
)
66

77
// debugging type
8-
// - has a Printf method to write the debug output
8+
// - has a Printf method to write the debug output
99
type debugging bool
1010

1111
// Enable controls debugging mode.

v3/dn.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ func (a *AttributeTypeAndValue) Equal(other *AttributeTypeAndValue) bool {
286286
return strings.EqualFold(a.Type, other.Type) && a.Value == other.Value
287287
}
288288

289-
// Equal returns true if the DNs are equal as defined by rfc4517 4.2.15 (distinguishedNameMatch).
289+
// EqualFold returns true if the DNs are equal as defined by rfc4517 4.2.15 (distinguishedNameMatch).
290290
// Returns true if they have the same number of relative distinguished names
291291
// and corresponding relative distinguished names (by position) are the same.
292292
// Case of the attribute type and value is not significant
@@ -318,7 +318,7 @@ func (d *DN) AncestorOfFold(other *DN) bool {
318318
return true
319319
}
320320

321-
// Equal returns true if the RelativeDNs are equal as defined by rfc4517 4.2.15 (distinguishedNameMatch).
321+
// EqualFold returns true if the RelativeDNs are equal as defined by rfc4517 4.2.15 (distinguishedNameMatch).
322322
// Case of the attribute type is not significant
323323
func (r *RelativeDN) EqualFold(other *RelativeDN) bool {
324324
if len(r.Attributes) != len(other.Attributes) {

v3/moddn.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ type ModifyDNRequest struct {
2323
// RDN of the given DN.
2424
//
2525
// A call like
26-
// mdnReq := NewModifyDNRequest("uid=someone,dc=example,dc=org", "uid=newname", true, "")
26+
//
27+
// mdnReq := NewModifyDNRequest("uid=someone,dc=example,dc=org", "uid=newname", true, "")
28+
//
2729
// will setup the request to just rename uid=someone,dc=example,dc=org to
2830
// uid=newname,dc=example,dc=org.
2931
func NewModifyDNRequest(dn string, rdn string, delOld bool, newSup string) *ModifyDNRequest {
@@ -40,7 +42,7 @@ func NewModifyDNRequest(dn string, rdn string, delOld bool, newSup string) *Modi
4042
//
4143
// Refer NewModifyDNRequest for other parameters
4244
func NewModifyDNWithControlsRequest(dn string, rdn string, delOld bool,
43-
newSup string, controls []Control) *ModifyDNRequest {
45+
newSup string, controls []Control) *ModifyDNRequest {
4446
return &ModifyDNRequest{
4547
DN: dn,
4648
NewRDN: rdn,

v3/request.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ import (
99
var (
1010
errRespChanClosed = errors.New("ldap: response channel closed")
1111
errCouldNotRetMsg = errors.New("ldap: could not retrieve message")
12-
ErrNilConnection = errors.New("ldap: conn is nil, expected net.Conn")
12+
// ErrNilConnection is returned if doRequest is called with a nil connection.
13+
ErrNilConnection = errors.New("ldap: conn is nil, expected net.Conn")
1314
)
1415

1516
type request interface {

v3/unbind.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
ber "github.com/go-asn1-ber/asn1-ber"
77
)
88

9+
// ErrConnUnbound is returned when Unbind is called on an already closing connection.
910
var ErrConnUnbound = NewError(ErrorNetwork, errors.New("ldap: connection is closed"))
1011

1112
type unbindRequest struct{}

0 commit comments

Comments
 (0)