Use Go 1.19 fmt for Gitea 1.17, sync emoji data (#21239)
The images used by Gitea's drone pipeline were upgraded to Go 1.19.x It causes the lint fails because Go 1.19 uses new code format. This PR partially backport #20758 (including the emoji-data sync), partially fix the format manually.
This commit is contained in:
parent
937ef6fa90
commit
20c135cd46
2
Makefile
2
Makefile
|
@ -33,7 +33,7 @@ GOFUMPT_PACKAGE ?= mvdan.cc/gofumpt@v0.3.1
|
||||||
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/golangci-lint@v1.46.0
|
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/golangci-lint@v1.46.0
|
||||||
GXZ_PAGAGE ?= github.com/ulikunitz/xz/cmd/gxz@v0.5.10
|
GXZ_PAGAGE ?= github.com/ulikunitz/xz/cmd/gxz@v0.5.10
|
||||||
MISSPELL_PACKAGE ?= github.com/client9/misspell/cmd/misspell@v0.3.4
|
MISSPELL_PACKAGE ?= github.com/client9/misspell/cmd/misspell@v0.3.4
|
||||||
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/swagger@v0.29.0
|
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/swagger@v0.30.0
|
||||||
XGO_PACKAGE ?= src.techknowlogick.com/xgo@latest
|
XGO_PACKAGE ?= src.techknowlogick.com/xgo@latest
|
||||||
|
|
||||||
DOCKER_IMAGE ?= gitea/gitea
|
DOCKER_IMAGE ?= gitea/gitea
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -214,8 +214,7 @@ const hdr = `
|
||||||
|
|
||||||
package emoji
|
package emoji
|
||||||
|
|
||||||
// Code generated by gen.go. DO NOT EDIT.
|
// Code generated by build/generate-emoji.go. DO NOT EDIT.
|
||||||
// Sourced from %s
|
// Sourced from %s
|
||||||
//
|
|
||||||
var GemojiData = %#v
|
var GemojiData = %#v
|
||||||
`
|
`
|
||||||
|
|
|
@ -36,20 +36,20 @@ func drawBlock(img *image.Paletted, x, y, size, angle int, points []int) {
|
||||||
|
|
||||||
// blank
|
// blank
|
||||||
//
|
//
|
||||||
// --------
|
// --------
|
||||||
// | |
|
// | |
|
||||||
// | |
|
// | |
|
||||||
// | |
|
// | |
|
||||||
// --------
|
// --------
|
||||||
func b0(img *image.Paletted, x, y, size, angle int) {}
|
func b0(img *image.Paletted, x, y, size, angle int) {}
|
||||||
|
|
||||||
// full-filled
|
// full-filled
|
||||||
//
|
//
|
||||||
// --------
|
// --------
|
||||||
// |######|
|
// |######|
|
||||||
// |######|
|
// |######|
|
||||||
// |######|
|
// |######|
|
||||||
// --------
|
// --------
|
||||||
func b1(img *image.Paletted, x, y, size, angle int) {
|
func b1(img *image.Paletted, x, y, size, angle int) {
|
||||||
for i := x; i < x+size; i++ {
|
for i := x; i < x+size; i++ {
|
||||||
for j := y; j < y+size; j++ {
|
for j := y; j < y+size; j++ {
|
||||||
|
@ -59,12 +59,13 @@ func b1(img *image.Paletted, x, y, size, angle int) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// a small block
|
// a small block
|
||||||
// ----------
|
//
|
||||||
// | |
|
// ----------
|
||||||
// | #### |
|
// | |
|
||||||
// | #### |
|
// | #### |
|
||||||
// | |
|
// | #### |
|
||||||
// ----------
|
// | |
|
||||||
|
// ----------
|
||||||
func b2(img *image.Paletted, x, y, size, angle int) {
|
func b2(img *image.Paletted, x, y, size, angle int) {
|
||||||
l := size / 4
|
l := size / 4
|
||||||
x += l
|
x += l
|
||||||
|
@ -79,15 +80,15 @@ func b2(img *image.Paletted, x, y, size, angle int) {
|
||||||
|
|
||||||
// diamond
|
// diamond
|
||||||
//
|
//
|
||||||
// ---------
|
// ---------
|
||||||
// | # |
|
// | # |
|
||||||
// | ### |
|
// | ### |
|
||||||
// | ##### |
|
// | ##### |
|
||||||
// |#######|
|
// |#######|
|
||||||
// | ##### |
|
// | ##### |
|
||||||
// | ### |
|
// | ### |
|
||||||
// | # |
|
// | # |
|
||||||
// ---------
|
// ---------
|
||||||
func b3(img *image.Paletted, x, y, size, angle int) {
|
func b3(img *image.Paletted, x, y, size, angle int) {
|
||||||
m := size / 2
|
m := size / 2
|
||||||
drawBlock(img, x, y, size, 0, []int{
|
drawBlock(img, x, y, size, 0, []int{
|
||||||
|
@ -101,13 +102,13 @@ func b3(img *image.Paletted, x, y, size, angle int) {
|
||||||
|
|
||||||
// b4
|
// b4
|
||||||
//
|
//
|
||||||
// -------
|
// -------
|
||||||
// |#####|
|
// |#####|
|
||||||
// |#### |
|
// |#### |
|
||||||
// |### |
|
// |### |
|
||||||
// |## |
|
// |## |
|
||||||
// |# |
|
// |# |
|
||||||
// |------
|
// |------
|
||||||
func b4(img *image.Paletted, x, y, size, angle int) {
|
func b4(img *image.Paletted, x, y, size, angle int) {
|
||||||
drawBlock(img, x, y, size, angle, []int{
|
drawBlock(img, x, y, size, angle, []int{
|
||||||
0, 0,
|
0, 0,
|
||||||
|
@ -119,11 +120,11 @@ func b4(img *image.Paletted, x, y, size, angle int) {
|
||||||
|
|
||||||
// b5
|
// b5
|
||||||
//
|
//
|
||||||
// ---------
|
// ---------
|
||||||
// | # |
|
// | # |
|
||||||
// | ### |
|
// | ### |
|
||||||
// | ##### |
|
// | ##### |
|
||||||
// |#######|
|
// |#######|
|
||||||
func b5(img *image.Paletted, x, y, size, angle int) {
|
func b5(img *image.Paletted, x, y, size, angle int) {
|
||||||
m := size / 2
|
m := size / 2
|
||||||
drawBlock(img, x, y, size, angle, []int{
|
drawBlock(img, x, y, size, angle, []int{
|
||||||
|
@ -136,11 +137,11 @@ func b5(img *image.Paletted, x, y, size, angle int) {
|
||||||
|
|
||||||
// b6
|
// b6
|
||||||
//
|
//
|
||||||
// --------
|
// --------
|
||||||
// |### |
|
// |### |
|
||||||
// |### |
|
// |### |
|
||||||
// |### |
|
// |### |
|
||||||
// --------
|
// --------
|
||||||
func b6(img *image.Paletted, x, y, size, angle int) {
|
func b6(img *image.Paletted, x, y, size, angle int) {
|
||||||
m := size / 2
|
m := size / 2
|
||||||
drawBlock(img, x, y, size, angle, []int{
|
drawBlock(img, x, y, size, angle, []int{
|
||||||
|
@ -154,12 +155,12 @@ func b6(img *image.Paletted, x, y, size, angle int) {
|
||||||
|
|
||||||
// b7 italic cone
|
// b7 italic cone
|
||||||
//
|
//
|
||||||
// ---------
|
// ---------
|
||||||
// | # |
|
// | # |
|
||||||
// | ## |
|
// | ## |
|
||||||
// | #####|
|
// | #####|
|
||||||
// | ####|
|
// | ####|
|
||||||
// |--------
|
// |--------
|
||||||
func b7(img *image.Paletted, x, y, size, angle int) {
|
func b7(img *image.Paletted, x, y, size, angle int) {
|
||||||
m := size / 2
|
m := size / 2
|
||||||
drawBlock(img, x, y, size, angle, []int{
|
drawBlock(img, x, y, size, angle, []int{
|
||||||
|
@ -173,14 +174,14 @@ func b7(img *image.Paletted, x, y, size, angle int) {
|
||||||
|
|
||||||
// b8 three small triangles
|
// b8 three small triangles
|
||||||
//
|
//
|
||||||
// -----------
|
// -----------
|
||||||
// | # |
|
// | # |
|
||||||
// | ### |
|
// | ### |
|
||||||
// | ##### |
|
// | ##### |
|
||||||
// | # # |
|
// | # # |
|
||||||
// | ### ### |
|
// | ### ### |
|
||||||
// |#########|
|
// |#########|
|
||||||
// -----------
|
// -----------
|
||||||
func b8(img *image.Paletted, x, y, size, angle int) {
|
func b8(img *image.Paletted, x, y, size, angle int) {
|
||||||
m := size / 2
|
m := size / 2
|
||||||
mm := m / 2
|
mm := m / 2
|
||||||
|
@ -212,13 +213,13 @@ func b8(img *image.Paletted, x, y, size, angle int) {
|
||||||
|
|
||||||
// b9 italic triangle
|
// b9 italic triangle
|
||||||
//
|
//
|
||||||
// ---------
|
// ---------
|
||||||
// |# |
|
// |# |
|
||||||
// | #### |
|
// | #### |
|
||||||
// | #####|
|
// | #####|
|
||||||
// | #### |
|
// | #### |
|
||||||
// | # |
|
// | # |
|
||||||
// ---------
|
// ---------
|
||||||
func b9(img *image.Paletted, x, y, size, angle int) {
|
func b9(img *image.Paletted, x, y, size, angle int) {
|
||||||
m := size / 2
|
m := size / 2
|
||||||
drawBlock(img, x, y, size, angle, []int{
|
drawBlock(img, x, y, size, angle, []int{
|
||||||
|
@ -231,16 +232,16 @@ func b9(img *image.Paletted, x, y, size, angle int) {
|
||||||
|
|
||||||
// b10
|
// b10
|
||||||
//
|
//
|
||||||
// ----------
|
// ----------
|
||||||
// | ####|
|
// | ####|
|
||||||
// | ### |
|
// | ### |
|
||||||
// | ## |
|
// | ## |
|
||||||
// | # |
|
// | # |
|
||||||
// |#### |
|
// |#### |
|
||||||
// |### |
|
// |### |
|
||||||
// |## |
|
// |## |
|
||||||
// |# |
|
// |# |
|
||||||
// ----------
|
// ----------
|
||||||
func b10(img *image.Paletted, x, y, size, angle int) {
|
func b10(img *image.Paletted, x, y, size, angle int) {
|
||||||
m := size / 2
|
m := size / 2
|
||||||
drawBlock(img, x, y, size, angle, []int{
|
drawBlock(img, x, y, size, angle, []int{
|
||||||
|
@ -260,13 +261,13 @@ func b10(img *image.Paletted, x, y, size, angle int) {
|
||||||
|
|
||||||
// b11
|
// b11
|
||||||
//
|
//
|
||||||
// ----------
|
// ----------
|
||||||
// |#### |
|
// |#### |
|
||||||
// |#### |
|
// |#### |
|
||||||
// |#### |
|
// |#### |
|
||||||
// | |
|
// | |
|
||||||
// | |
|
// | |
|
||||||
// ----------
|
// ----------
|
||||||
func b11(img *image.Paletted, x, y, size, angle int) {
|
func b11(img *image.Paletted, x, y, size, angle int) {
|
||||||
m := size / 2
|
m := size / 2
|
||||||
drawBlock(img, x, y, size, angle, []int{
|
drawBlock(img, x, y, size, angle, []int{
|
||||||
|
@ -280,13 +281,13 @@ func b11(img *image.Paletted, x, y, size, angle int) {
|
||||||
|
|
||||||
// b12
|
// b12
|
||||||
//
|
//
|
||||||
// -----------
|
// -----------
|
||||||
// | |
|
// | |
|
||||||
// | |
|
// | |
|
||||||
// |#########|
|
// |#########|
|
||||||
// | ##### |
|
// | ##### |
|
||||||
// | # |
|
// | # |
|
||||||
// -----------
|
// -----------
|
||||||
func b12(img *image.Paletted, x, y, size, angle int) {
|
func b12(img *image.Paletted, x, y, size, angle int) {
|
||||||
m := size / 2
|
m := size / 2
|
||||||
drawBlock(img, x, y, size, angle, []int{
|
drawBlock(img, x, y, size, angle, []int{
|
||||||
|
@ -299,13 +300,13 @@ func b12(img *image.Paletted, x, y, size, angle int) {
|
||||||
|
|
||||||
// b13
|
// b13
|
||||||
//
|
//
|
||||||
// -----------
|
// -----------
|
||||||
// | |
|
// | |
|
||||||
// | |
|
// | |
|
||||||
// | # |
|
// | # |
|
||||||
// | ##### |
|
// | ##### |
|
||||||
// |#########|
|
// |#########|
|
||||||
// -----------
|
// -----------
|
||||||
func b13(img *image.Paletted, x, y, size, angle int) {
|
func b13(img *image.Paletted, x, y, size, angle int) {
|
||||||
m := size / 2
|
m := size / 2
|
||||||
drawBlock(img, x, y, size, angle, []int{
|
drawBlock(img, x, y, size, angle, []int{
|
||||||
|
@ -318,13 +319,13 @@ func b13(img *image.Paletted, x, y, size, angle int) {
|
||||||
|
|
||||||
// b14
|
// b14
|
||||||
//
|
//
|
||||||
// ---------
|
// ---------
|
||||||
// | # |
|
// | # |
|
||||||
// | ### |
|
// | ### |
|
||||||
// |#### |
|
// |#### |
|
||||||
// | |
|
// | |
|
||||||
// | |
|
// | |
|
||||||
// ---------
|
// ---------
|
||||||
func b14(img *image.Paletted, x, y, size, angle int) {
|
func b14(img *image.Paletted, x, y, size, angle int) {
|
||||||
m := size / 2
|
m := size / 2
|
||||||
drawBlock(img, x, y, size, angle, []int{
|
drawBlock(img, x, y, size, angle, []int{
|
||||||
|
@ -337,13 +338,13 @@ func b14(img *image.Paletted, x, y, size, angle int) {
|
||||||
|
|
||||||
// b15
|
// b15
|
||||||
//
|
//
|
||||||
// ----------
|
// ----------
|
||||||
// |##### |
|
// |##### |
|
||||||
// |### |
|
// |### |
|
||||||
// |# |
|
// |# |
|
||||||
// | |
|
// | |
|
||||||
// | |
|
// | |
|
||||||
// ----------
|
// ----------
|
||||||
func b15(img *image.Paletted, x, y, size, angle int) {
|
func b15(img *image.Paletted, x, y, size, angle int) {
|
||||||
m := size / 2
|
m := size / 2
|
||||||
drawBlock(img, x, y, size, angle, []int{
|
drawBlock(img, x, y, size, angle, []int{
|
||||||
|
@ -356,14 +357,14 @@ func b15(img *image.Paletted, x, y, size, angle int) {
|
||||||
|
|
||||||
// b16
|
// b16
|
||||||
//
|
//
|
||||||
// ---------
|
// ---------
|
||||||
// | # |
|
// | # |
|
||||||
// | ##### |
|
// | ##### |
|
||||||
// |#######|
|
// |#######|
|
||||||
// | # |
|
// | # |
|
||||||
// | ##### |
|
// | ##### |
|
||||||
// |#######|
|
// |#######|
|
||||||
// ---------
|
// ---------
|
||||||
func b16(img *image.Paletted, x, y, size, angle int) {
|
func b16(img *image.Paletted, x, y, size, angle int) {
|
||||||
m := size / 2
|
m := size / 2
|
||||||
drawBlock(img, x, y, size, angle, []int{
|
drawBlock(img, x, y, size, angle, []int{
|
||||||
|
@ -383,13 +384,13 @@ func b16(img *image.Paletted, x, y, size, angle int) {
|
||||||
|
|
||||||
// b17
|
// b17
|
||||||
//
|
//
|
||||||
// ----------
|
// ----------
|
||||||
// |##### |
|
// |##### |
|
||||||
// |### |
|
// |### |
|
||||||
// |# |
|
// |# |
|
||||||
// | ##|
|
// | ##|
|
||||||
// | ##|
|
// | ##|
|
||||||
// ----------
|
// ----------
|
||||||
func b17(img *image.Paletted, x, y, size, angle int) {
|
func b17(img *image.Paletted, x, y, size, angle int) {
|
||||||
m := size / 2
|
m := size / 2
|
||||||
|
|
||||||
|
@ -412,13 +413,13 @@ func b17(img *image.Paletted, x, y, size, angle int) {
|
||||||
|
|
||||||
// b18
|
// b18
|
||||||
//
|
//
|
||||||
// ----------
|
// ----------
|
||||||
// |##### |
|
// |##### |
|
||||||
// |#### |
|
// |#### |
|
||||||
// |### |
|
// |### |
|
||||||
// |## |
|
// |## |
|
||||||
// |# |
|
// |# |
|
||||||
// ----------
|
// ----------
|
||||||
func b18(img *image.Paletted, x, y, size, angle int) {
|
func b18(img *image.Paletted, x, y, size, angle int) {
|
||||||
m := size / 2
|
m := size / 2
|
||||||
|
|
||||||
|
@ -432,13 +433,13 @@ func b18(img *image.Paletted, x, y, size, angle int) {
|
||||||
|
|
||||||
// b19
|
// b19
|
||||||
//
|
//
|
||||||
// ----------
|
// ----------
|
||||||
// |########|
|
// |########|
|
||||||
// |### ###|
|
// |### ###|
|
||||||
// |# #|
|
// |# #|
|
||||||
// |### ###|
|
// |### ###|
|
||||||
// |########|
|
// |########|
|
||||||
// ----------
|
// ----------
|
||||||
func b19(img *image.Paletted, x, y, size, angle int) {
|
func b19(img *image.Paletted, x, y, size, angle int) {
|
||||||
m := size / 2
|
m := size / 2
|
||||||
|
|
||||||
|
@ -473,13 +474,13 @@ func b19(img *image.Paletted, x, y, size, angle int) {
|
||||||
|
|
||||||
// b20
|
// b20
|
||||||
//
|
//
|
||||||
// ----------
|
// ----------
|
||||||
// | ## |
|
// | ## |
|
||||||
// |### |
|
// |### |
|
||||||
// |## |
|
// |## |
|
||||||
// |## |
|
// |## |
|
||||||
// |# |
|
// |# |
|
||||||
// ----------
|
// ----------
|
||||||
func b20(img *image.Paletted, x, y, size, angle int) {
|
func b20(img *image.Paletted, x, y, size, angle int) {
|
||||||
m := size / 2
|
m := size / 2
|
||||||
q := size / 4
|
q := size / 4
|
||||||
|
@ -494,13 +495,13 @@ func b20(img *image.Paletted, x, y, size, angle int) {
|
||||||
|
|
||||||
// b21
|
// b21
|
||||||
//
|
//
|
||||||
// ----------
|
// ----------
|
||||||
// | #### |
|
// | #### |
|
||||||
// |## #####|
|
// |## #####|
|
||||||
// |## ##|
|
// |## ##|
|
||||||
// |## |
|
// |## |
|
||||||
// |# |
|
// |# |
|
||||||
// ----------
|
// ----------
|
||||||
func b21(img *image.Paletted, x, y, size, angle int) {
|
func b21(img *image.Paletted, x, y, size, angle int) {
|
||||||
m := size / 2
|
m := size / 2
|
||||||
q := size / 4
|
q := size / 4
|
||||||
|
@ -522,13 +523,13 @@ func b21(img *image.Paletted, x, y, size, angle int) {
|
||||||
|
|
||||||
// b22
|
// b22
|
||||||
//
|
//
|
||||||
// ----------
|
// ----------
|
||||||
// | #### |
|
// | #### |
|
||||||
// |## ### |
|
// |## ### |
|
||||||
// |## ##|
|
// |## ##|
|
||||||
// |## ##|
|
// |## ##|
|
||||||
// |# #|
|
// |# #|
|
||||||
// ----------
|
// ----------
|
||||||
func b22(img *image.Paletted, x, y, size, angle int) {
|
func b22(img *image.Paletted, x, y, size, angle int) {
|
||||||
m := size / 2
|
m := size / 2
|
||||||
q := size / 4
|
q := size / 4
|
||||||
|
@ -550,13 +551,13 @@ func b22(img *image.Paletted, x, y, size, angle int) {
|
||||||
|
|
||||||
// b23
|
// b23
|
||||||
//
|
//
|
||||||
// ----------
|
// ----------
|
||||||
// | #######|
|
// | #######|
|
||||||
// |### #|
|
// |### #|
|
||||||
// |## |
|
// |## |
|
||||||
// |## |
|
// |## |
|
||||||
// |# |
|
// |# |
|
||||||
// ----------
|
// ----------
|
||||||
func b23(img *image.Paletted, x, y, size, angle int) {
|
func b23(img *image.Paletted, x, y, size, angle int) {
|
||||||
m := size / 2
|
m := size / 2
|
||||||
q := size / 4
|
q := size / 4
|
||||||
|
@ -578,13 +579,13 @@ func b23(img *image.Paletted, x, y, size, angle int) {
|
||||||
|
|
||||||
// b24
|
// b24
|
||||||
//
|
//
|
||||||
// ----------
|
// ----------
|
||||||
// | ## ###|
|
// | ## ###|
|
||||||
// |### ###|
|
// |### ###|
|
||||||
// |## ## |
|
// |## ## |
|
||||||
// |## ## |
|
// |## ## |
|
||||||
// |# # |
|
// |# # |
|
||||||
// ----------
|
// ----------
|
||||||
func b24(img *image.Paletted, x, y, size, angle int) {
|
func b24(img *image.Paletted, x, y, size, angle int) {
|
||||||
m := size / 2
|
m := size / 2
|
||||||
q := size / 4
|
q := size / 4
|
||||||
|
@ -606,13 +607,13 @@ func b24(img *image.Paletted, x, y, size, angle int) {
|
||||||
|
|
||||||
// b25
|
// b25
|
||||||
//
|
//
|
||||||
// ----------
|
// ----------
|
||||||
// |# #|
|
// |# #|
|
||||||
// |## ###|
|
// |## ###|
|
||||||
// |## ## |
|
// |## ## |
|
||||||
// |###### |
|
// |###### |
|
||||||
// |#### |
|
// |#### |
|
||||||
// ----------
|
// ----------
|
||||||
func b25(img *image.Paletted, x, y, size, angle int) {
|
func b25(img *image.Paletted, x, y, size, angle int) {
|
||||||
m := size / 2
|
m := size / 2
|
||||||
q := size / 4
|
q := size / 4
|
||||||
|
@ -634,13 +635,13 @@ func b25(img *image.Paletted, x, y, size, angle int) {
|
||||||
|
|
||||||
// b26
|
// b26
|
||||||
//
|
//
|
||||||
// ----------
|
// ----------
|
||||||
// |# #|
|
// |# #|
|
||||||
// |### ###|
|
// |### ###|
|
||||||
// | #### |
|
// | #### |
|
||||||
// |### ###|
|
// |### ###|
|
||||||
// |# #|
|
// |# #|
|
||||||
// ----------
|
// ----------
|
||||||
func b26(img *image.Paletted, x, y, size, angle int) {
|
func b26(img *image.Paletted, x, y, size, angle int) {
|
||||||
m := size / 2
|
m := size / 2
|
||||||
q := size / 4
|
q := size / 4
|
||||||
|
@ -676,13 +677,13 @@ func b26(img *image.Paletted, x, y, size, angle int) {
|
||||||
|
|
||||||
// b27
|
// b27
|
||||||
//
|
//
|
||||||
// ----------
|
// ----------
|
||||||
// |########|
|
// |########|
|
||||||
// |## ###|
|
// |## ###|
|
||||||
// |# #|
|
// |# #|
|
||||||
// |### ##|
|
// |### ##|
|
||||||
// |########|
|
// |########|
|
||||||
// ----------
|
// ----------
|
||||||
func b27(img *image.Paletted, x, y, size, angle int) {
|
func b27(img *image.Paletted, x, y, size, angle int) {
|
||||||
m := size / 2
|
m := size / 2
|
||||||
q := size / 4
|
q := size / 4
|
||||||
|
|
|
@ -118,7 +118,7 @@ type CanCommitToBranchResults struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// CanCommitToBranch returns true if repository is editable and user has proper access level
|
// CanCommitToBranch returns true if repository is editable and user has proper access level
|
||||||
// and branch is not protected for push
|
// and branch is not protected for push
|
||||||
func (r *Repository) CanCommitToBranch(ctx context.Context, doer *user_model.User) (CanCommitToBranchResults, error) {
|
func (r *Repository) CanCommitToBranch(ctx context.Context, doer *user_model.User) (CanCommitToBranchResults, error) {
|
||||||
protectedBranch, err := git_model.GetProtectedBranchBy(ctx, r.Repository.ID, r.BranchName)
|
protectedBranch, err := git_model.GetProtectedBranchBy(ctx, r.Repository.ID, r.BranchName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -322,7 +322,7 @@ func TestGuessDelimiter(t *testing.T) {
|
||||||
},
|
},
|
||||||
// case 3 - tab delimited
|
// case 3 - tab delimited
|
||||||
{
|
{
|
||||||
csv: "1 2",
|
csv: "1\t2",
|
||||||
expectedDelimiter: '\t',
|
expectedDelimiter: '\t',
|
||||||
},
|
},
|
||||||
// case 4 - pipe delimited
|
// case 4 - pipe delimited
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -68,8 +68,7 @@ func NewParser(r io.Reader, format Format) *Parser {
|
||||||
//
|
//
|
||||||
// It could, for example return something like:
|
// It could, for example return something like:
|
||||||
//
|
//
|
||||||
// { "objecttype": "tag", "refname:short": "v1.16.4", "object": "f460b7543ed500e49c133c2cd85c8c55ee9dbe27" }
|
// { "objecttype": "tag", "refname:short": "v1.16.4", "object": "f460b7543ed500e49c133c2cd85c8c55ee9dbe27" }
|
||||||
//
|
|
||||||
func (p *Parser) Next() map[string]string {
|
func (p *Parser) Next() map[string]string {
|
||||||
if !p.scanner.Scan() {
|
if !p.scanner.Scan() {
|
||||||
return nil
|
return nil
|
||||||
|
@ -89,8 +88,7 @@ func (p *Parser) Err() error {
|
||||||
|
|
||||||
// parseRef parses out all key-value pairs from a single reference block, such as
|
// parseRef parses out all key-value pairs from a single reference block, such as
|
||||||
//
|
//
|
||||||
// "objecttype tag\0refname:short v1.16.4\0object f460b7543ed500e49c133c2cd85c8c55ee9dbe27"
|
// "objecttype tag\0refname:short v1.16.4\0object f460b7543ed500e49c133c2cd85c8c55ee9dbe27"
|
||||||
//
|
|
||||||
func (p *Parser) parseRef(refBlock string) (map[string]string, error) {
|
func (p *Parser) parseRef(refBlock string) (map[string]string, error) {
|
||||||
if refBlock == "" {
|
if refBlock == "" {
|
||||||
// must be at EOF
|
// must be at EOF
|
||||||
|
|
|
@ -19,8 +19,10 @@ import (
|
||||||
type Signature = object.Signature
|
type Signature = object.Signature
|
||||||
|
|
||||||
// Helper to get a signature from the commit line, which looks like these:
|
// Helper to get a signature from the commit line, which looks like these:
|
||||||
// author Patrick Gundlach <gundlach@speedata.de> 1378823654 +0200
|
//
|
||||||
// author Patrick Gundlach <gundlach@speedata.de> Thu, 07 Apr 2005 22:13:13 +0200
|
// author Patrick Gundlach <gundlach@speedata.de> 1378823654 +0200
|
||||||
|
// author Patrick Gundlach <gundlach@speedata.de> Thu, 07 Apr 2005 22:13:13 +0200
|
||||||
|
//
|
||||||
// but without the "author " at the beginning (this method should)
|
// but without the "author " at the beginning (this method should)
|
||||||
// be used for author and committer.
|
// be used for author and committer.
|
||||||
//
|
//
|
||||||
|
|
|
@ -37,8 +37,10 @@ func (s *Signature) Decode(b []byte) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper to get a signature from the commit line, which looks like these:
|
// Helper to get a signature from the commit line, which looks like these:
|
||||||
// author Patrick Gundlach <gundlach@speedata.de> 1378823654 +0200
|
//
|
||||||
// author Patrick Gundlach <gundlach@speedata.de> Thu, 07 Apr 2005 22:13:13 +0200
|
// author Patrick Gundlach <gundlach@speedata.de> 1378823654 +0200
|
||||||
|
// author Patrick Gundlach <gundlach@speedata.de> Thu, 07 Apr 2005 22:13:13 +0200
|
||||||
|
//
|
||||||
// but without the "author " at the beginning (this method should)
|
// but without the "author " at the beginning (this method should)
|
||||||
// be used for author and committer.
|
// be used for author and committer.
|
||||||
func newSignatureFromCommitline(line []byte) (sig *Signature, err error) {
|
func newSignatureFromCommitline(line []byte) (sig *Signature, err error) {
|
||||||
|
|
|
@ -93,6 +93,7 @@ func NewFileLogger() LoggerProvider {
|
||||||
|
|
||||||
// Init file logger with json config.
|
// Init file logger with json config.
|
||||||
// config like:
|
// config like:
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// "filename":"log/gogs.log",
|
// "filename":"log/gogs.log",
|
||||||
// "maxsize":1<<30,
|
// "maxsize":1<<30,
|
||||||
|
|
|
@ -48,6 +48,7 @@ func NewSMTPLogger() LoggerProvider {
|
||||||
|
|
||||||
// Init smtp writer with json config.
|
// Init smtp writer with json config.
|
||||||
// config like:
|
// config like:
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// "Username":"example@gmail.com",
|
// "Username":"example@gmail.com",
|
||||||
// "password:"password",
|
// "password:"password",
|
||||||
|
|
|
@ -141,7 +141,7 @@ func (r *stripRenderer) AddOptions(...renderer.Option) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// StripMarkdown parses markdown content by removing all markup and code blocks
|
// StripMarkdown parses markdown content by removing all markup and code blocks
|
||||||
// in order to extract links and other references
|
// in order to extract links and other references
|
||||||
func StripMarkdown(rawBytes []byte) (string, []string) {
|
func StripMarkdown(rawBytes []byte) (string, []string) {
|
||||||
buf, links := StripMarkdownBytes(rawBytes)
|
buf, links := StripMarkdownBytes(rawBytes)
|
||||||
return string(buf), links
|
return string(buf), links
|
||||||
|
@ -153,7 +153,7 @@ var (
|
||||||
)
|
)
|
||||||
|
|
||||||
// StripMarkdownBytes parses markdown content by removing all markup and code blocks
|
// StripMarkdownBytes parses markdown content by removing all markup and code blocks
|
||||||
// in order to extract links and other references
|
// in order to extract links and other references
|
||||||
func StripMarkdownBytes(rawBytes []byte) ([]byte, []string) {
|
func StripMarkdownBytes(rawBytes []byte) ([]byte, []string) {
|
||||||
once.Do(func() {
|
once.Do(func() {
|
||||||
gdMarkdown := goldmark.New(
|
gdMarkdown := goldmark.New(
|
||||||
|
|
|
@ -25,7 +25,7 @@ func DumpMemProfileForUsername(pprofDataPath, username string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// DumpCPUProfileForUsername dumps a CPU profile at pprofDataPath as cpuprofile_<username>_<temporary id>
|
// DumpCPUProfileForUsername dumps a CPU profile at pprofDataPath as cpuprofile_<username>_<temporary id>
|
||||||
// it returns the stop function which stops, writes and closes the CPU profile file
|
// the stop function it returns stops, writes and closes the CPU profile file
|
||||||
func DumpCPUProfileForUsername(pprofDataPath, username string) (func(), error) {
|
func DumpCPUProfileForUsername(pprofDataPath, username string) (func(), error) {
|
||||||
f, err := os.CreateTemp(pprofDataPath, fmt.Sprintf("cpuprofile_%s_", username))
|
f, err := os.CreateTemp(pprofDataPath, fmt.Sprintf("cpuprofile_%s_", username))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -31,8 +31,8 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
GitHub, GitLab, Gogs: *.wiki.git
|
GitHub, GitLab, Gogs: *.wiki.git
|
||||||
BitBucket: *.git/wiki
|
BitBucket: *.git/wiki
|
||||||
*/
|
*/
|
||||||
var commonWikiURLSuffixes = []string{".wiki.git", ".git/wiki"}
|
var commonWikiURLSuffixes = []string{".wiki.git", ".git/wiki"}
|
||||||
|
|
||||||
|
|
|
@ -17,13 +17,13 @@ func isSnakeCaseLowerOrNumber(c byte) bool {
|
||||||
// ToSnakeCase convert the input string to snake_case format.
|
// ToSnakeCase convert the input string to snake_case format.
|
||||||
//
|
//
|
||||||
// Some samples.
|
// Some samples.
|
||||||
// "FirstName" => "first_name"
|
|
||||||
// "HTTPServer" => "http_server"
|
|
||||||
// "NoHTTPS" => "no_https"
|
|
||||||
// "GO_PATH" => "go_path"
|
|
||||||
// "GO PATH" => "go_path" // space is converted to underscore.
|
|
||||||
// "GO-PATH" => "go_path" // hyphen is converted to underscore.
|
|
||||||
//
|
//
|
||||||
|
// "FirstName" => "first_name"
|
||||||
|
// "HTTPServer" => "http_server"
|
||||||
|
// "NoHTTPS" => "no_https"
|
||||||
|
// "GO_PATH" => "go_path"
|
||||||
|
// "GO PATH" => "go_path" // space is converted to underscore.
|
||||||
|
// "GO-PATH" => "go_path" // hyphen is converted to underscore.
|
||||||
func ToSnakeCase(input string) string {
|
func ToSnakeCase(input string) string {
|
||||||
if len(input) == 0 {
|
if len(input) == 0 {
|
||||||
return ""
|
return ""
|
||||||
|
|
|
@ -7,59 +7,59 @@
|
||||||
//
|
//
|
||||||
// This documentation describes the Gitea API.
|
// This documentation describes the Gitea API.
|
||||||
//
|
//
|
||||||
// Schemes: http, https
|
// Schemes: http, https
|
||||||
// BasePath: /api/v1
|
// BasePath: /api/v1
|
||||||
// Version: {{AppVer | JSEscape | Safe}}
|
// Version: {{AppVer | JSEscape | Safe}}
|
||||||
// License: MIT http://opensource.org/licenses/MIT
|
// License: MIT http://opensource.org/licenses/MIT
|
||||||
//
|
//
|
||||||
// Consumes:
|
// Consumes:
|
||||||
// - application/json
|
// - application/json
|
||||||
// - text/plain
|
// - text/plain
|
||||||
//
|
//
|
||||||
// Produces:
|
// Produces:
|
||||||
// - application/json
|
// - application/json
|
||||||
// - text/html
|
// - text/html
|
||||||
//
|
//
|
||||||
// Security:
|
// Security:
|
||||||
// - BasicAuth :
|
// - BasicAuth :
|
||||||
// - Token :
|
// - Token :
|
||||||
// - AccessToken :
|
// - AccessToken :
|
||||||
// - AuthorizationHeaderToken :
|
// - AuthorizationHeaderToken :
|
||||||
// - SudoParam :
|
// - SudoParam :
|
||||||
// - SudoHeader :
|
// - SudoHeader :
|
||||||
// - TOTPHeader :
|
// - TOTPHeader :
|
||||||
//
|
//
|
||||||
// SecurityDefinitions:
|
// SecurityDefinitions:
|
||||||
// BasicAuth:
|
// BasicAuth:
|
||||||
// type: basic
|
// type: basic
|
||||||
// Token:
|
// Token:
|
||||||
// type: apiKey
|
// type: apiKey
|
||||||
// name: token
|
// name: token
|
||||||
// in: query
|
// in: query
|
||||||
// AccessToken:
|
// AccessToken:
|
||||||
// type: apiKey
|
// type: apiKey
|
||||||
// name: access_token
|
// name: access_token
|
||||||
// in: query
|
// in: query
|
||||||
// AuthorizationHeaderToken:
|
// AuthorizationHeaderToken:
|
||||||
// type: apiKey
|
// type: apiKey
|
||||||
// name: Authorization
|
// name: Authorization
|
||||||
// in: header
|
// in: header
|
||||||
// description: API tokens must be prepended with "token" followed by a space.
|
// description: API tokens must be prepended with "token" followed by a space.
|
||||||
// SudoParam:
|
// SudoParam:
|
||||||
// type: apiKey
|
// type: apiKey
|
||||||
// name: sudo
|
// name: sudo
|
||||||
// in: query
|
// in: query
|
||||||
// description: Sudo API request as the user provided as the key. Admin privileges are required.
|
// description: Sudo API request as the user provided as the key. Admin privileges are required.
|
||||||
// SudoHeader:
|
// SudoHeader:
|
||||||
// type: apiKey
|
// type: apiKey
|
||||||
// name: Sudo
|
// name: Sudo
|
||||||
// in: header
|
// in: header
|
||||||
// description: Sudo API request as the user provided as the key. Admin privileges are required.
|
// description: Sudo API request as the user provided as the key. Admin privileges are required.
|
||||||
// TOTPHeader:
|
// TOTPHeader:
|
||||||
// type: apiKey
|
// type: apiKey
|
||||||
// name: X-GITEA-OTP
|
// name: X-GITEA-OTP
|
||||||
// in: header
|
// in: header
|
||||||
// description: Must be used in combination with BasicAuth if two-factor authentication is enabled.
|
// description: Must be used in combination with BasicAuth if two-factor authentication is enabled.
|
||||||
//
|
//
|
||||||
// swagger:meta
|
// swagger:meta
|
||||||
package v1
|
package v1
|
||||||
|
|
|
@ -34,7 +34,7 @@ func GetGitAllRefs(ctx *context.APIContext) {
|
||||||
// required: true
|
// required: true
|
||||||
// responses:
|
// responses:
|
||||||
// "200":
|
// "200":
|
||||||
// "$ref": "#/responses/Reference"
|
// # "$ref": "#/responses/Reference" TODO: swagger doesnt support different output formats by ref
|
||||||
// "$ref": "#/responses/ReferenceList"
|
// "$ref": "#/responses/ReferenceList"
|
||||||
// "404":
|
// "404":
|
||||||
// "$ref": "#/responses/notFound"
|
// "$ref": "#/responses/notFound"
|
||||||
|
@ -67,7 +67,7 @@ func GetGitRefs(ctx *context.APIContext) {
|
||||||
// required: true
|
// required: true
|
||||||
// responses:
|
// responses:
|
||||||
// "200":
|
// "200":
|
||||||
// "$ref": "#/responses/Reference"
|
// # "$ref": "#/responses/Reference" TODO: swagger doesnt support different output formats by ref
|
||||||
// "$ref": "#/responses/ReferenceList"
|
// "$ref": "#/responses/ReferenceList"
|
||||||
// "404":
|
// "404":
|
||||||
// "$ref": "#/responses/notFound"
|
// "$ref": "#/responses/notFound"
|
||||||
|
|
|
@ -566,6 +566,8 @@ func ListMyTrackedTimes(ctx *context.APIContext) {
|
||||||
// swagger:operation GET /user/times user userCurrentTrackedTimes
|
// swagger:operation GET /user/times user userCurrentTrackedTimes
|
||||||
// ---
|
// ---
|
||||||
// summary: List the current user's tracked times
|
// summary: List the current user's tracked times
|
||||||
|
// produces:
|
||||||
|
// - application/json
|
||||||
// parameters:
|
// parameters:
|
||||||
// - name: page
|
// - name: page
|
||||||
// in: query
|
// in: query
|
||||||
|
@ -575,9 +577,6 @@ func ListMyTrackedTimes(ctx *context.APIContext) {
|
||||||
// in: query
|
// in: query
|
||||||
// description: page size of results
|
// description: page size of results
|
||||||
// type: integer
|
// type: integer
|
||||||
// produces:
|
|
||||||
// - application/json
|
|
||||||
// parameters:
|
|
||||||
// - name: since
|
// - name: since
|
||||||
// in: query
|
// in: query
|
||||||
// description: Only show times updated after the given time. This is a timestamp in RFC 3339 format
|
// description: Only show times updated after the given time. This is a timestamp in RFC 3339 format
|
||||||
|
|
|
@ -585,7 +585,6 @@ func Edit(ctx *context.APIContext) {
|
||||||
// description: name of the repo to edit
|
// description: name of the repo to edit
|
||||||
// type: string
|
// type: string
|
||||||
// required: true
|
// required: true
|
||||||
// required: true
|
|
||||||
// - name: body
|
// - name: body
|
||||||
// in: body
|
// in: body
|
||||||
// description: "Properties of a repo that you can edit"
|
// description: "Properties of a repo that you can edit"
|
||||||
|
|
|
@ -48,11 +48,6 @@ func AddEmail(ctx *context.APIContext) {
|
||||||
// produces:
|
// produces:
|
||||||
// - application/json
|
// - application/json
|
||||||
// parameters:
|
// parameters:
|
||||||
// - name: options
|
|
||||||
// in: body
|
|
||||||
// schema:
|
|
||||||
// "$ref": "#/definitions/CreateEmailOption"
|
|
||||||
// parameters:
|
|
||||||
// - name: body
|
// - name: body
|
||||||
// in: body
|
// in: body
|
||||||
// schema:
|
// schema:
|
||||||
|
|
|
@ -26,7 +26,6 @@ import (
|
||||||
"code.gitea.io/gitea/modules/structs"
|
"code.gitea.io/gitea/modules/structs"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
|
|
||||||
"gopkg.in/yaml.v2"
|
"gopkg.in/yaml.v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -78,8 +78,9 @@ type GiteaDownloader struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewGiteaDownloader creates a gitea Downloader via gitea API
|
// NewGiteaDownloader creates a gitea Downloader via gitea API
|
||||||
// Use either a username/password or personal token. token is preferred
|
//
|
||||||
// Note: Public access only allows very basic access
|
// Use either a username/password or personal token. token is preferred
|
||||||
|
// Note: Public access only allows very basic access
|
||||||
func NewGiteaDownloader(ctx context.Context, baseURL, repoPath, username, password, token string) (*GiteaDownloader, error) {
|
func NewGiteaDownloader(ctx context.Context, baseURL, repoPath, username, password, token string) (*GiteaDownloader, error) {
|
||||||
giteaClient, err := gitea_sdk.NewClient(
|
giteaClient, err := gitea_sdk.NewClient(
|
||||||
baseURL,
|
baseURL,
|
||||||
|
|
|
@ -71,8 +71,9 @@ type GitlabDownloader struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewGitlabDownloader creates a gitlab Downloader via gitlab API
|
// NewGitlabDownloader creates a gitlab Downloader via gitlab API
|
||||||
// Use either a username/password, personal token entered into the username field, or anonymous/public access
|
//
|
||||||
// Note: Public access only allows very basic access
|
// Use either a username/password, personal token entered into the username field, or anonymous/public access
|
||||||
|
// Note: Public access only allows very basic access
|
||||||
func NewGitlabDownloader(ctx context.Context, baseURL, repoPath, username, password, token string) (*GitlabDownloader, error) {
|
func NewGitlabDownloader(ctx context.Context, baseURL, repoPath, username, password, token string) (*GitlabDownloader, error) {
|
||||||
gitlabClient, err := gitlab.NewClient(token, gitlab.WithBaseURL(baseURL), gitlab.WithHTTPClient(NewMigrationHTTPClient()))
|
gitlabClient, err := gitlab.NewClient(token, gitlab.WithBaseURL(baseURL), gitlab.WithHTTPClient(NewMigrationHTTPClient()))
|
||||||
// Only use basic auth if token is blank and password is NOT
|
// Only use basic auth if token is blank and password is NOT
|
||||||
|
@ -374,7 +375,8 @@ type gitlabIssueContext struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetIssues returns issues according start and limit
|
// GetIssues returns issues according start and limit
|
||||||
// Note: issue label description and colors are not supported by the go-gitlab library at this time
|
//
|
||||||
|
// Note: issue label description and colors are not supported by the go-gitlab library at this time
|
||||||
func (g *GitlabDownloader) GetIssues(page, perPage int) ([]*base.Issue, bool, error) {
|
func (g *GitlabDownloader) GetIssues(page, perPage int) ([]*base.Issue, bool, error) {
|
||||||
state := "all"
|
state := "all"
|
||||||
sort := "asc"
|
sort := "asc"
|
||||||
|
|
|
@ -12420,6 +12420,18 @@
|
||||||
"summary": "List the current user's tracked times",
|
"summary": "List the current user's tracked times",
|
||||||
"operationId": "userCurrentTrackedTimes",
|
"operationId": "userCurrentTrackedTimes",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "page number of results to return (1-based)",
|
||||||
|
"name": "page",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "page size of results",
|
||||||
|
"name": "limit",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"format": "date-time",
|
"format": "date-time",
|
||||||
|
@ -15619,7 +15631,6 @@
|
||||||
"$ref": "#/definitions/FileCommitResponse"
|
"$ref": "#/definitions/FileCommitResponse"
|
||||||
},
|
},
|
||||||
"content": {
|
"content": {
|
||||||
"type": "object",
|
|
||||||
"x-go-name": "Content"
|
"x-go-name": "Content"
|
||||||
},
|
},
|
||||||
"verification": {
|
"verification": {
|
||||||
|
@ -18661,7 +18672,6 @@
|
||||||
"x-go-name": "Ignored"
|
"x-go-name": "Ignored"
|
||||||
},
|
},
|
||||||
"reason": {
|
"reason": {
|
||||||
"type": "object",
|
|
||||||
"x-go-name": "Reason"
|
"x-go-name": "Reason"
|
||||||
},
|
},
|
||||||
"repository_url": {
|
"repository_url": {
|
||||||
|
|
Loading…
Reference in New Issue