Refactor markup package (#32399)

To make the markup package easier to maintain:
1. Split some go files into small files
2. Use a shared util.NopCloser, remove duplicate code
3. Remove unused functions
This commit is contained in:
wxiaoguang 2024-11-04 18:59:50 +08:00 committed by GitHub
parent af28ce59b8
commit 61be51e56b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 1154 additions and 1087 deletions

View file

@ -10,6 +10,7 @@ import (
"io"
"testing"
"code.gitea.io/gitea/modules/util"
"code.gitea.io/gitea/modules/zstd"
"github.com/blakesmith/ar"
@ -77,7 +78,7 @@ func TestParsePackage(t *testing.T) {
{
Extension: "",
WriterFactory: func(w io.Writer) io.WriteCloser {
return nopCloser{w}
return util.NopCloser{Writer: w}
},
},
{
@ -129,14 +130,6 @@ func TestParsePackage(t *testing.T) {
})
}
type nopCloser struct {
io.Writer
}
func (nopCloser) Close() error {
return nil
}
func TestParseControlFile(t *testing.T) {
buildContent := func(name, version, architecture string) *bytes.Buffer {
var buf bytes.Buffer