Browse Source

lint: fix lint errors

Tommy Murphy 3 years ago
parent
commit
548fffe0ae
4 changed files with 10 additions and 10 deletions
  1. 2 2
      header.go
  2. 3 3
      header_test.go
  3. 1 1
      report.go
  4. 4 4
      report_test.go

+ 2 - 2
header.go

@@ -14,7 +14,7 @@ type Header struct {
 	IncludeSubDomains bool
 	Permanent         bool
 	Sha256Pins        []string
-	ReportUri         string
+	ReportURI         string
 }
 
 // Matches checks whether the provided pin is in the header list
@@ -83,7 +83,7 @@ func populate(h *Header, v string) *Header {
 
 		i = strings.Index(field, "report-uri")
 		if i >= 0 {
-			h.ReportUri = field[i+12 : len(field)-1]
+			h.ReportURI = field[i+12 : len(field)-1]
 			continue
 		}
 

+ 3 - 3
header_test.go

@@ -148,7 +148,7 @@ func TestParseHeader(t *testing.T) {
 					"E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g=",
 					"LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ=",
 				},
-				ReportUri: "http://example.com/pkp-report",
+				ReportURI: "http://example.com/pkp-report",
 			},
 		},
 		{
@@ -292,7 +292,7 @@ func TestParseReportOnlyHeader(t *testing.T) {
 					"E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g=",
 					"LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ=",
 				},
-				ReportUri: "http://example.com/pkp-report",
+				ReportURI: "http://example.com/pkp-report",
 			},
 		},
 	}
@@ -328,7 +328,7 @@ func equalHeaders(a, b *Header) bool {
 		return false
 	}
 
-	if a.ReportUri != b.ReportUri {
+	if a.ReportURI != b.ReportURI {
 		return false
 	}
 

+ 1 - 1
report.go

@@ -43,7 +43,7 @@ func NewPinFailure(host string, port int, h *Header, c tls.ConnectionState) (*Pi
 		ServedCertificateChain:    encodeCertificatesPEM(c.PeerCertificates),
 		ValidatedCertificateChain: encodeCertificatesPEM(verifiedChain),
 		KnownPins:                 h.Sha256Pins,
-	}, h.ReportUri
+	}, h.ReportURI
 }
 
 // encodeCertificatesPEM converts a slice of x509 certficates to a slice of PEM encoded strings

+ 4 - 4
report_test.go

@@ -131,7 +131,7 @@ func TestNewPinFailure(t *testing.T) {
 		header         *Header
 		connState      tls.ConnectionState
 		expectedReport *PinFailure
-		expectedUri    string
+		expectedURI    string
 	}{
 		{
 			name: "nil test",
@@ -164,15 +164,15 @@ func TestNewPinFailure(t *testing.T) {
 				ServedCertificateChain:    certs[:1],
 				ValidatedCertificateChain: certs,
 			},
-			expectedUri: "",
+			expectedURI: "",
 		},
 	}
 
 	for _, test := range tests {
 		pf, uri := NewPinFailure(test.host, test.port, test.header, test.connState)
 
-		if uri != test.expectedUri {
-			t.Logf("want:%v", test.expectedUri)
+		if uri != test.expectedURI {
+			t.Logf("want:%v", test.expectedURI)
 			t.Logf("got:%v", uri)
 			t.Fatalf("test case failed: %s", test.name)
 		}