mirror of
https://github.com/go-gitea/gitea.git
synced 2026-05-06 08:26:41 -04:00
a9108ab6aa
Use `golangci-lint fmt` to format code, replacing the previous custom formatter tool. https://github.com/daixiang0/gci is used to order the imports. `make fmt` performs ~13% faster while consuming ~57% less cpu while formatting for me. `GOFUMPT_PACKAGE` is gone because it's using the builtin package from golangci-lint. Co-authored-by: Claude (claude-opus-4-6) <noreply@anthropic.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
37 lines
692 B
Go
37 lines
692 B
Go
// Copyright 2022 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
//go:build bindata
|
|
|
|
//go:generate go run ../../build/generate-bindata.go ../../modules/migration/schemas bindata.dat
|
|
|
|
package migration
|
|
|
|
import (
|
|
"io/fs"
|
|
"path"
|
|
"sync"
|
|
|
|
"code.gitea.io/gitea/modules/assetfs"
|
|
|
|
_ "embed"
|
|
|
|
"github.com/santhosh-tekuri/jsonschema/v6"
|
|
)
|
|
|
|
//go:embed bindata.dat
|
|
var bindata []byte
|
|
|
|
var BuiltinAssets = sync.OnceValue(func() fs.FS {
|
|
return assetfs.NewEmbeddedFS(bindata)
|
|
})
|
|
|
|
func openSchema(filename string) (any, error) {
|
|
f, err := BuiltinAssets().Open(path.Base(filename))
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer f.Close()
|
|
return jsonschema.UnmarshalJSON(f)
|
|
}
|