diff options
author | Runxi Yu <me@runxiyu.org> | 2025-03-31 16:59:18 +0800 |
---|---|---|
committer | Runxi Yu <me@runxiyu.org> | 2025-03-31 16:59:18 +0800 |
commit | 655b6b211ae6df0186abd740f248939f7ddeaec1 (patch) | |
tree | ec5cdbbc52222f62c8fbb0bcf2a1aa7a9f6eb8b6 /ssh_utils.go | |
parent | Correct table headers in MR indices (diff) | |
download | forge-655b6b211ae6df0186abd740f248939f7ddeaec1.tar.gz forge-655b6b211ae6df0186abd740f248939f7ddeaec1.tar.zst forge-655b6b211ae6df0186abd740f248939f7ddeaec1.zip |
Add descriptive comments to most Go functions
Diffstat (limited to 'ssh_utils.go')
-rw-r--r-- | ssh_utils.go | 5 |
1 files changed, 5 insertions, 0 deletions
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) } |