From 681ca36b1c0078b84eeae5253a9ffac22af86cba Mon Sep 17 00:00:00 2001 From: Manuel de Brito Fontes Date: Wed, 26 Jul 2017 23:07:59 -0400 Subject: [PATCH] Lint code --- core/pkg/ingress/annotations/auth/main.go | 1 + core/pkg/ingress/annotations/authreq/main.go | 1 + core/pkg/ingress/annotations/authtls/main.go | 1 + core/pkg/ingress/annotations/ipwhitelist/main.go | 1 + core/pkg/ingress/annotations/proxy/main.go | 1 + core/pkg/ingress/annotations/ratelimit/main.go | 2 ++ core/pkg/ingress/annotations/rewrite/main.go | 1 + .../ingress/annotations/serviceupstream/main_test.go | 4 ++-- core/pkg/ingress/resolver/main.go | 1 + core/pkg/ingress/types_equals.go | 10 ++++++++++ 10 files changed, 21 insertions(+), 2 deletions(-) diff --git a/core/pkg/ingress/annotations/auth/main.go b/core/pkg/ingress/annotations/auth/main.go index 89775d6b1..b0c017f00 100644 --- a/core/pkg/ingress/annotations/auth/main.go +++ b/core/pkg/ingress/annotations/auth/main.go @@ -53,6 +53,7 @@ type BasicDigest struct { Secured bool `json:"secured"` } +// Equal tests for equality between two BasicDigest types func (bd1 *BasicDigest) Equal(bd2 *BasicDigest) bool { if bd1 == bd2 { return true diff --git a/core/pkg/ingress/annotations/authreq/main.go b/core/pkg/ingress/annotations/authreq/main.go index bb6799780..8289a7e33 100644 --- a/core/pkg/ingress/annotations/authreq/main.go +++ b/core/pkg/ingress/annotations/authreq/main.go @@ -47,6 +47,7 @@ type External struct { ResponseHeaders []string `json:"responseHeaders,omitEmpty"` } +// Equal tests for equality between two External types func (e1 *External) Equal(e2 *External) bool { if e1 == e2 { return true diff --git a/core/pkg/ingress/annotations/authtls/main.go b/core/pkg/ingress/annotations/authtls/main.go index aeb95b19a..7b7e4833a 100644 --- a/core/pkg/ingress/annotations/authtls/main.go +++ b/core/pkg/ingress/annotations/authtls/main.go @@ -40,6 +40,7 @@ type AuthSSLConfig struct { ValidationDepth int `json:"validationDepth"` } +// Equal tests for equality between two AuthSSLConfig types func (assl1 *AuthSSLConfig) Equal(assl2 *AuthSSLConfig) bool { if assl1 == assl2 { return true diff --git a/core/pkg/ingress/annotations/ipwhitelist/main.go b/core/pkg/ingress/annotations/ipwhitelist/main.go index 6b624a454..91df4bf60 100644 --- a/core/pkg/ingress/annotations/ipwhitelist/main.go +++ b/core/pkg/ingress/annotations/ipwhitelist/main.go @@ -39,6 +39,7 @@ type SourceRange struct { CIDR []string `json:"cidr,omitEmpty"` } +// Equal tests for equality between two SourceRange types func (sr1 *SourceRange) Equal(sr2 *SourceRange) bool { if sr1 == sr2 { return true diff --git a/core/pkg/ingress/annotations/proxy/main.go b/core/pkg/ingress/annotations/proxy/main.go index 529695c08..b43040282 100644 --- a/core/pkg/ingress/annotations/proxy/main.go +++ b/core/pkg/ingress/annotations/proxy/main.go @@ -46,6 +46,7 @@ type Configuration struct { NextUpstream string `json:"nextUpstream"` } +// Equal tests for equality between two Configuration types func (l1 *Configuration) Equal(l2 *Configuration) bool { if l1 == l2 { return true diff --git a/core/pkg/ingress/annotations/ratelimit/main.go b/core/pkg/ingress/annotations/ratelimit/main.go index 4d95459ae..4504a7580 100644 --- a/core/pkg/ingress/annotations/ratelimit/main.go +++ b/core/pkg/ingress/annotations/ratelimit/main.go @@ -47,6 +47,7 @@ type RateLimit struct { RPS Zone `json:"rps"` } +// Equal tests for equality between two RateLimit types func (rt1 *RateLimit) Equal(rt2 *RateLimit) bool { if rt1 == rt2 { return true @@ -74,6 +75,7 @@ type Zone struct { SharedSize int `json:"sharedSize"` } +// Equal tests for equality between two Zone types func (z1 *Zone) Equal(z2 *Zone) bool { if z1 == z2 { return true diff --git a/core/pkg/ingress/annotations/rewrite/main.go b/core/pkg/ingress/annotations/rewrite/main.go index 1e8dd60fc..52cb984fd 100644 --- a/core/pkg/ingress/annotations/rewrite/main.go +++ b/core/pkg/ingress/annotations/rewrite/main.go @@ -46,6 +46,7 @@ type Redirect struct { AppRoot string `json:"appRoot"` } +// Equal tests for equality between two Redirect types func (r1 *Redirect) Equal(r2 *Redirect) bool { if r1 == r2 { return true diff --git a/core/pkg/ingress/annotations/serviceupstream/main_test.go b/core/pkg/ingress/annotations/serviceupstream/main_test.go index 340446610..9dcfdece6 100644 --- a/core/pkg/ingress/annotations/serviceupstream/main_test.go +++ b/core/pkg/ingress/annotations/serviceupstream/main_test.go @@ -19,10 +19,10 @@ package serviceupstream import ( "testing" - meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/util/intstr" api "k8s.io/api/core/v1" extensions "k8s.io/api/extensions/v1beta1" + meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/intstr" ) func buildIngress() *extensions.Ingress { diff --git a/core/pkg/ingress/resolver/main.go b/core/pkg/ingress/resolver/main.go index 7ace6123c..db545f0a3 100644 --- a/core/pkg/ingress/resolver/main.go +++ b/core/pkg/ingress/resolver/main.go @@ -52,6 +52,7 @@ type AuthSSLCert struct { PemSHA string `json:"pemSha"` } +// Equal tests for equality between two AuthSSLCert types func (asslc1 *AuthSSLCert) Equal(assl2 *AuthSSLCert) bool { if asslc1.Secret != assl2.Secret { return false diff --git a/core/pkg/ingress/types_equals.go b/core/pkg/ingress/types_equals.go index a670d6a9e..6b0a2132c 100644 --- a/core/pkg/ingress/types_equals.go +++ b/core/pkg/ingress/types_equals.go @@ -16,6 +16,7 @@ limitations under the License. package ingress +// Equal tests for equality between two BackendInfo types func (bi1 *BackendInfo) Equal(bi2 *BackendInfo) bool { if bi1 == bi2 { return true @@ -39,6 +40,7 @@ func (bi1 *BackendInfo) Equal(bi2 *BackendInfo) bool { return true } +// Equal tests for equality between two Configuration types func (c1 *Configuration) Equal(c2 *Configuration) bool { if c1 == c2 { return true @@ -135,6 +137,7 @@ func (c1 *Configuration) Equal(c2 *Configuration) bool { return true } +// Equal tests for equality between two Backend types func (b1 *Backend) Equal(b2 *Backend) bool { if b1 == b2 { return true @@ -199,6 +202,7 @@ func (b1 *Backend) Equal(b2 *Backend) bool { return true } +// Equal tests for equality between two SessionAffinityConfig types func (sac1 *SessionAffinityConfig) Equal(sac2 *SessionAffinityConfig) bool { if sac1 == sac2 { return true @@ -216,6 +220,7 @@ func (sac1 *SessionAffinityConfig) Equal(sac2 *SessionAffinityConfig) bool { return true } +// Equal tests for equality between two CookieSessionAffinity types func (csa1 *CookieSessionAffinity) Equal(csa2 *CookieSessionAffinity) bool { if csa1 == csa2 { return true @@ -257,6 +262,7 @@ func (e1 *Endpoint) Equal(e2 *Endpoint) bool { return true } +// Equal tests for equality between two Server types func (s1 *Server) Equal(s2 *Server) bool { if s1 == s2 { return true @@ -297,6 +303,7 @@ func (s1 *Server) Equal(s2 *Server) bool { return true } +// Equal tests for equality between two Location types func (l1 *Location) Equal(l2 *Location) bool { if l1 == l2 { return true @@ -371,6 +378,7 @@ func (l1 *Location) Equal(l2 *Location) bool { return true } +// Equal tests for equality between two SSLPassthroughBackend types func (ptb1 *SSLPassthroughBackend) Equal(ptb2 *SSLPassthroughBackend) bool { if ptb1 == ptb2 { return true @@ -407,6 +415,7 @@ func (ptb1 *SSLPassthroughBackend) Equal(ptb2 *SSLPassthroughBackend) bool { return true } +// Equal tests for equality between two L4Service types func (e1 *L4Service) Equal(e2 *L4Service) bool { if e1 == e2 { return true @@ -440,6 +449,7 @@ func (e1 *L4Service) Equal(e2 *L4Service) bool { return true } +// Equal tests for equality between two L4Backend types func (l4b1 *L4Backend) Equal(l4b2 *L4Backend) bool { if l4b1 == l4b2 { return true