From 54c2cc1fc69797c5f4fc440e736e86f0e1f3ae0b Mon Sep 17 00:00:00 2001 From: Ian McEwen Date: Fri, 18 Oct 2024 09:39:34 -0700 Subject: [PATCH] better comment docs --- instantlaunches/mgmt.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/instantlaunches/mgmt.go b/instantlaunches/mgmt.go index 12248a7..30179b1 100644 --- a/instantlaunches/mgmt.go +++ b/instantlaunches/mgmt.go @@ -10,13 +10,14 @@ import ( "github.com/labstack/echo/v4" ) +// suffixUsername takes a possibly-already-suffixed username, strips any suffix, and adds the provided one, to ensure proper suffixing func suffixUsername(username, suffix string) string { re, _ := regexp.Compile(`@.*$`) return fmt.Sprintf("%s@%s", re.ReplaceAllString(username, ""), strings.Trim(suffix, "@")) } +// checkUserMatches ensures that `first` and `second` match when both suffixed the same. func checkUserMatches(first, second, suffix string) bool { - // Just make sure both usernames match when properly suffixed return (suffixUsername(first, suffix) == suffixUsername(second, suffix)) }