From 4d8d33d124bb8333541fdc333a724d4e16073961 Mon Sep 17 00:00:00 2001 From: knottnt Date: Mon, 5 May 2025 10:08:40 -0700 Subject: [PATCH 1/3] Update names_test.go Add test cases for HTTP and HTTPS fields. --- names/names_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/names/names_test.go b/names/names_test.go index 5cdb813..4bfcbbe 100644 --- a/names/names_test.go +++ b/names/names_test.go @@ -65,6 +65,12 @@ func TestNames(t *testing.T) { {"FifoTopic", "FIFOTopic", "fifoTopic", "fifo_topic", "fifotopic"}, {"HttpsPort", "HTTPSPort", "httpsPort", "https_port", "httpsport"}, {"HTTPSPort", "HTTPSPort", "httpsPort", "https_port", "httpsport"}, + {"HTTPPort", "HTTPPort", "httpPort", "http_port", "httpport"}, + {"HttpPort", "HTTPPort", "httpPort", "http_port", "httpport"}, + {"HttpError", "HTTPError", "httpError", "http_error", "httperror"}, + {"HTTPError", "HTTPError", "httpError", "http_error", "httperror"}, + {"HttpStatus", "HTTPStatus", "httpStatus", "http_status", "httpstatus"}, + {"HTTPStatus", "HTTPStatus", "httpStatus", "http_status", "httpstatus"}, {"Id", "ID", "id", "id", "id"}, {"ID", "ID", "id", "id", "id"}, {"Idle", "Idle", "idle", "idle", "idle"}, From e4f5d68fe39fcb65870951da0797c0f9569ccde1 Mon Sep 17 00:00:00 2001 From: knottnt Date: Mon, 5 May 2025 10:13:20 -0700 Subject: [PATCH 2/3] Update names.go Reduce scope of HTTP regex to only match with HTTP if not followed by an 'S' and another capital letter and Http if not followed be can 's'. --- names/names.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/names/names.go b/names/names.go index 175060a..a1ea439 100644 --- a/names/names.go +++ b/names/names.go @@ -135,7 +135,7 @@ var ( {"Grpc", "GRPC", "grpc", nil}, {"Html", "HTML", "html", nil}, // Prevent HTTPSPort from becoming httpSPort - {"Http", "HTTP", "http", re2.MustCompile("HTTP(?!s|S)", re2.None)}, + {"Http", "HTTP", "http", re2.MustCompile("(HTTP((?!S[A-Z]))|Http(?!s))", re2.None)}, {"Https", "HTTPS", "https", nil}, {"Iam", "IAM", "iam", nil}, {"Icmp", "ICMP", "icmp", nil}, From 2f89dc3bdd74e9a30866636058b069e8542961d6 Mon Sep 17 00:00:00 2001 From: knottnt Date: Mon, 5 May 2025 10:13:54 -0700 Subject: [PATCH 3/3] Update names_test.go Add additional test case for Http vs Https --- names/names_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/names/names_test.go b/names/names_test.go index 4bfcbbe..f8473e3 100644 --- a/names/names_test.go +++ b/names/names_test.go @@ -71,6 +71,10 @@ func TestNames(t *testing.T) { {"HTTPError", "HTTPError", "httpError", "http_error", "httperror"}, {"HttpStatus", "HTTPStatus", "httpStatus", "http_status", "httpstatus"}, {"HTTPStatus", "HTTPStatus", "httpStatus", "http_status", "httpstatus"}, + {"HTTPSSupport", "HTTPSSupport", "httpsSupport", "https_support", "httpssupport"}, + {"HttpsSupport", "HTTPSSupport", "httpsSupport", "https_support", "httpssupport"}, + {"HttpSupport", "HTTPSupport", "httpSupport", "http_support", "httpsupport"}, + {"HTTPSupport", "HTTPSupport", "httpSupport", "http_support", "httpsupport"}, {"Id", "ID", "id", "id", "id"}, {"ID", "ID", "id", "id", "id"}, {"Idle", "Idle", "idle", "idle", "idle"},