From 655b6b211ae6df0186abd740f248939f7ddeaec1 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Mon, 31 Mar 2025 16:59:18 +0800 Subject: Add descriptive comments to most Go functions --- ssh_utils.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'ssh_utils.go') diff --git a/ssh_utils.go b/ssh_utils.go index ef6b33b..94aabe4 100644 --- a/ssh_utils.go +++ b/ssh_utils.go @@ -16,6 +16,8 @@ import ( var errIllegalSSHRepoPath = errors.New("illegal SSH repo path") +// getRepoInfo2 also fetches repo information... it should be deprecated and +// implemented in individual handlers. func getRepoInfo2(ctx context.Context, sshPath, sshPubkey string) (groupPath []string, repoName string, repoID int, repoPath string, directAccess bool, contribReq, userType string, userID int, err error) { var segments []string var sepIndex int @@ -66,6 +68,9 @@ func getRepoInfo2(ctx context.Context, sshPath, sshPubkey string) (groupPath []s } } +// writeRedError is a helper function that basically does a Fprintf but makes +// the entire thing red, in terms of ANSI escape sequences. It's useful when +// producing error messages on SSH connections. func writeRedError(w io.Writer, format string, args ...any) { fmt.Fprintln(w, ansiec.Red+fmt.Sprintf(format, args...)+ansiec.Reset) } -- cgit v1.2.3