From e0635b47c2f30719e1ea026812af85c988632c0e Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Sat, 05 Apr 2025 21:27:17 +0800 Subject: [PATCH] Move things to internal/ --- ansiec/colors.go => internal/ansiec/colors.go | 0 ansiec/reset.go => internal/ansiec/reset.go | 0 ansiec/style.go => internal/ansiec/style.go | 0 git2c/client.go => internal/git2c/client.go | 0 git2c/cmd1.go => internal/git2c/cmd1.go | 0 git2c/cmd2.go => internal/git2c/cmd2.go | 0 git2c/git_types.go => internal/git2c/git_types.go | 0 git_hooks_handle_linux.go | 4 ++-- git_hooks_handle_other.go | 4 ++-- git_plumbing.go | 2 +- http_handle_branches.go | 2 +- http_handle_group_index.go | 2 +- http_handle_repo_commit.go | 2 +- http_handle_repo_index.go | 4 ++-- http_handle_repo_raw.go | 4 ++-- http_handle_repo_tree.go | 4 ++-- http_server.go | 2 +- lmtp_handle_patch.go | 2 +- lmtp_server.go | 2 +- misc/misc.go => internal/misc/misc.go | 0 misc/unsafe.go => internal/misc/unsafe.go | 0 misc/url.go => internal/misc/url.go | 0 remote_url.go | 2 +- render/chroma.go => internal/render/chroma.go | 0 render/escape.go => internal/render/escape.go | 0 render/readme.go => internal/render/readme.go | 2 +- resources.go | 2 +- ssh_server.go | 4 ++-- ssh_utils.go | 4 ++-- diff --git a/ansiec/colors.go b/internal/ansiec/colors.go rename from ansiec/colors.go rename to internal/ansiec/colors.go diff --git a/ansiec/reset.go b/internal/ansiec/reset.go rename from ansiec/reset.go rename to internal/ansiec/reset.go diff --git a/ansiec/style.go b/internal/ansiec/style.go rename from ansiec/style.go rename to internal/ansiec/style.go diff --git a/git2c/client.go b/internal/git2c/client.go rename from git2c/client.go rename to internal/git2c/client.go diff --git a/git2c/cmd1.go b/internal/git2c/cmd1.go rename from git2c/cmd1.go rename to internal/git2c/cmd1.go diff --git a/git2c/cmd2.go b/internal/git2c/cmd2.go rename from git2c/cmd2.go rename to internal/git2c/cmd2.go diff --git a/git2c/git_types.go b/internal/git2c/git_types.go rename from git2c/git_types.go rename to internal/git2c/git_types.go diff --git a/git_hooks_handle_linux.go b/git_hooks_handle_linux.go index 11013029df5ccefca02dfcdd83f86660689035b1..3d8c0110443d1877dbea2794f1305c34ad3fae8e 100644 --- a/git_hooks_handle_linux.go +++ b/git_hooks_handle_linux.go @@ -23,8 +23,8 @@ "github.com/go-git/go-git/v5/plumbing" "github.com/go-git/go-git/v5/plumbing/object" "github.com/jackc/pgx/v5" - "go.lindenii.runxiyu.org/forge/ansiec" - "go.lindenii.runxiyu.org/forge/misc" + "go.lindenii.runxiyu.org/forge/internal/ansiec" + "go.lindenii.runxiyu.org/forge/internal/misc" ) var ( diff --git a/git_hooks_handle_other.go b/git_hooks_handle_other.go index 4a4328f7b99f1ffcf6f6fc7f0a7c45c745abc0f2..f125ecbf556dde1bb3a0f59e0df0edd971f78512 100644 --- a/git_hooks_handle_other.go +++ b/git_hooks_handle_other.go @@ -21,8 +21,8 @@ "github.com/go-git/go-git/v5/plumbing" "github.com/go-git/go-git/v5/plumbing/object" "github.com/jackc/pgx/v5" - "go.lindenii.runxiyu.org/forge/ansiec" - "go.lindenii.runxiyu.org/forge/misc" + "go.lindenii.runxiyu.org/forge/internal/ansiec" + "go.lindenii.runxiyu.org/forge/internal/misc" ) var errGetFD = errors.New("unable to get file descriptor") diff --git a/git_plumbing.go b/git_plumbing.go index 440de7c64b2a1668c5ea72631ce77b4996b793de..8c73a937cce038e71af301e9039c7a25add130c5 100644 --- a/git_plumbing.go +++ b/git_plumbing.go @@ -14,7 +14,7 @@ "path" "sort" "strings" - "go.lindenii.runxiyu.org/forge/misc" + "go.lindenii.runxiyu.org/forge/internal/misc" ) func writeTree(ctx context.Context, repoPath string, entries []treeEntry) (string, error) { diff --git a/http_handle_branches.go b/http_handle_branches.go index 96c4ac7f4edf3c0f225de95eedc0b2684d0b2527..659287f7ed87015f3e406fd99be30cf295d85e22 100644 --- a/http_handle_branches.go +++ b/http_handle_branches.go @@ -10,7 +10,7 @@ "github.com/go-git/go-git/v5" "github.com/go-git/go-git/v5/plumbing" "github.com/go-git/go-git/v5/plumbing/storer" - "go.lindenii.runxiyu.org/forge/misc" + "go.lindenii.runxiyu.org/forge/internal/misc" ) // httpHandleRepoBranches provides the branches page in repos. diff --git a/http_handle_group_index.go b/http_handle_group_index.go index e0e460d4a6a190ead3148f0c86ed48e257fea4c4..3f6ed68165ed483f15e493a7a61782be13f6d747 100644 --- a/http_handle_group_index.go +++ b/http_handle_group_index.go @@ -11,7 +11,7 @@ "strconv" "github.com/jackc/pgx/v5" "github.com/jackc/pgx/v5/pgtype" - "go.lindenii.runxiyu.org/forge/misc" + "go.lindenii.runxiyu.org/forge/internal/misc" ) // httpHandleGroupIndex provides index pages for groups, which includes a list diff --git a/http_handle_repo_commit.go b/http_handle_repo_commit.go index 88ade4b47c1bb51eba14a0e3df03e38e714eb201..1042affa76e15b7e69dbf8c4698451f300754ca8 100644 --- a/http_handle_repo_commit.go +++ b/http_handle_repo_commit.go @@ -13,7 +13,7 @@ "github.com/go-git/go-git/v5/plumbing" "github.com/go-git/go-git/v5/plumbing/filemode" "github.com/go-git/go-git/v5/plumbing/format/diff" "github.com/go-git/go-git/v5/plumbing/object" - "go.lindenii.runxiyu.org/forge/misc" + "go.lindenii.runxiyu.org/forge/internal/misc" ) // usableFilePatch is a [diff.FilePatch] that is structured in a way more diff --git a/http_handle_repo_index.go b/http_handle_repo_index.go index edba57bb5930bcfbd900f7df520c73f6ecb451e0..40fd9b0ca4a87143a254058d31202adedcc1f139 100644 --- a/http_handle_repo_index.go +++ b/http_handle_repo_index.go @@ -6,8 +6,8 @@ import ( "net/http" - "go.lindenii.runxiyu.org/forge/git2c" - "go.lindenii.runxiyu.org/forge/render" + "go.lindenii.runxiyu.org/forge/internal/git2c" + "go.lindenii.runxiyu.org/forge/internal/render" ) type commitDisplay struct { diff --git a/http_handle_repo_raw.go b/http_handle_repo_raw.go index 7e19e02d4baa96f0ad8ed16d77af31954c9ddd5b..b714397e5200867003dea84c6f8f60cf1ed0716b 100644 --- a/http_handle_repo_raw.go +++ b/http_handle_repo_raw.go @@ -9,8 +9,8 @@ "html/template" "net/http" "strings" - "go.lindenii.runxiyu.org/forge/git2c" - "go.lindenii.runxiyu.org/forge/misc" + "go.lindenii.runxiyu.org/forge/internal/git2c" + "go.lindenii.runxiyu.org/forge/internal/misc" ) // httpHandleRepoRaw serves raw files, or directory listings that point to raw diff --git a/http_handle_repo_tree.go b/http_handle_repo_tree.go index e8e5ff805452cecf77e935282a9492bbe77a939b..00c682148932a6138817077334e597b36305ed1a 100644 --- a/http_handle_repo_tree.go +++ b/http_handle_repo_tree.go @@ -8,8 +8,8 @@ "html/template" "net/http" "strings" - "go.lindenii.runxiyu.org/forge/git2c" - "go.lindenii.runxiyu.org/forge/render" + "go.lindenii.runxiyu.org/forge/internal/git2c" + "go.lindenii.runxiyu.org/forge/internal/render" ) // httpHandleRepoTree provides a friendly, syntax-highlighted view of diff --git a/http_server.go b/http_server.go index fdb55b474c67fc9ead28fbdd3d8f26de3bc75b2b..cad3a3d6d3b1d8101054963a67c6a0d70cf192ff 100644 --- a/http_server.go +++ b/http_server.go @@ -12,7 +12,7 @@ "strconv" "strings" "github.com/jackc/pgx/v5" - "go.lindenii.runxiyu.org/forge/misc" + "go.lindenii.runxiyu.org/forge/internal/misc" ) // ServeHTTP handles all incoming HTTP requests and routes them to the correct diff --git a/lmtp_handle_patch.go b/lmtp_handle_patch.go index bf1b94c7bb12dc5e8ede3b8f94e861faca3bb26f..6841444fe1be07c4ef3e2f86cf2ad5d93a920166 100644 --- a/lmtp_handle_patch.go +++ b/lmtp_handle_patch.go @@ -16,7 +16,7 @@ "time" "github.com/bluekeyes/go-gitdiff/gitdiff" "github.com/go-git/go-git/v5" - "go.lindenii.runxiyu.org/forge/misc" + "go.lindenii.runxiyu.org/forge/internal/misc" ) func (s *Server) lmtpHandlePatch(session *lmtpSession, groupPath []string, repoName string, mbox io.Reader) (err error) { diff --git a/lmtp_server.go b/lmtp_server.go index 863a5c002e6ca189db97a67ee368c10f449933bc..ae912c5e91b6acfbc25f79743c4867be379e6a07 100644 --- a/lmtp_server.go +++ b/lmtp_server.go @@ -17,7 +17,7 @@ "time" "github.com/emersion/go-message" "github.com/emersion/go-smtp" - "go.lindenii.runxiyu.org/forge/misc" + "go.lindenii.runxiyu.org/forge/internal/misc" ) type lmtpHandler struct{} diff --git a/misc/misc.go b/internal/misc/misc.go rename from misc/misc.go rename to internal/misc/misc.go diff --git a/misc/unsafe.go b/internal/misc/unsafe.go rename from misc/unsafe.go rename to internal/misc/unsafe.go diff --git a/misc/url.go b/internal/misc/url.go rename from misc/url.go rename to internal/misc/url.go diff --git a/remote_url.go b/remote_url.go index 453ddeb8f00e172eaf2c59cd2981bbe011b43407..8fc5528be9b0661c2d87a56b51d8ac4959ac47dd 100644 --- a/remote_url.go +++ b/remote_url.go @@ -7,7 +7,7 @@ import ( "net/url" "strings" - "go.lindenii.runxiyu.org/forge/misc" + "go.lindenii.runxiyu.org/forge/internal/misc" ) // We don't use path.Join because it collapses multiple slashes into one. diff --git a/render/chroma.go b/internal/render/chroma.go rename from render/chroma.go rename to internal/render/chroma.go diff --git a/render/escape.go b/internal/render/escape.go rename from render/escape.go rename to internal/render/escape.go diff --git a/render/readme.go b/internal/render/readme.go rename from render/readme.go rename to internal/render/readme.go index 1a153fb317082e51118bce53b30ae55a2d2628d1..aecd2f7a89b3cef2232f0ec0e50863e22de97c20 100644 --- a/render/readme.go +++ b/internal/render/readme.go @@ -13,7 +13,7 @@ "github.com/microcosm-cc/bluemonday" "github.com/niklasfasching/go-org/org" "github.com/yuin/goldmark" "github.com/yuin/goldmark/extension" - "go.lindenii.runxiyu.org/forge/misc" + "go.lindenii.runxiyu.org/forge/internal/misc" ) var markdownConverter = goldmark.New(goldmark.WithExtensions(extension.GFM)) diff --git a/resources.go b/resources.go index ffe1008ca1fa11615a54446e611894b16b1bd114..0f2e1a9cff76d15d120b4480b8ef2ef56c054f97 100644 --- a/resources.go +++ b/resources.go @@ -10,7 +10,7 @@ "io/fs" "github.com/tdewolff/minify/v2" "github.com/tdewolff/minify/v2/html" - "go.lindenii.runxiyu.org/forge/misc" + "go.lindenii.runxiyu.org/forge/internal/misc" ) //go:embed LICENSE source.tar.gz diff --git a/ssh_server.go b/ssh_server.go index ed303b957330b0d63cf07c70340c0212fa417f36..07a1f34810799b464746a4d8d867b320c2025708 100644 --- a/ssh_server.go +++ b/ssh_server.go @@ -11,8 +11,8 @@ "os" "strings" gliderSSH "github.com/gliderlabs/ssh" - "go.lindenii.runxiyu.org/forge/ansiec" - "go.lindenii.runxiyu.org/forge/misc" + "go.lindenii.runxiyu.org/forge/internal/ansiec" + "go.lindenii.runxiyu.org/forge/internal/misc" goSSH "golang.org/x/crypto/ssh" ) diff --git a/ssh_utils.go b/ssh_utils.go index 8f04209455f6baec180577eac6359c32851b3ae4..7aeedfff42665c68245c63a54f43dc57641f90ab 100644 --- a/ssh_utils.go +++ b/ssh_utils.go @@ -10,8 +10,8 @@ "fmt" "io" "net/url" - "go.lindenii.runxiyu.org/forge/ansiec" - "go.lindenii.runxiyu.org/forge/misc" + "go.lindenii.runxiyu.org/forge/internal/ansiec" + "go.lindenii.runxiyu.org/forge/internal/misc" ) var errIllegalSSHRepoPath = errors.New("illegal SSH repo path") -- 2.48.1