Skip to content

Commit 2691234

Browse files
committed
Merge branch 'main-IB#1105051' of github.com:ibpl/gitea into main-IB#1105051
2 parents 5c8f905 + 2b6990c commit 2691234

File tree

609 files changed

+7025
-5361
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

609 files changed

+7025
-5361
lines changed

‎.gitattributes‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
* text=auto eol=lf
22
/vendor/** -text -eol linguist-vendored
33
/public/vendor/** -text -eol linguist-vendored
4+
/web_src/js/vendor/** -text -eol linguist-vendored
45
/templates/**/*.tmpl linguist-language=Handlebars
56
/.eslintrc linguist-language=YAML
67
/.stylelintrc linguist-language=YAML

‎.golangci.yml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ linters:
1717
- bidichk
1818
- ineffassign
1919
- revive
20+
- gofumpt
2021
enable-all: false
2122
disable-all: true
2223
fast: false
@@ -57,6 +58,9 @@ linters-settings:
5758
- name: errorf
5859
- name: duplicated-imports
5960
- name: modifies-value-receiver
61+
gofumpt:
62+
extra-rules: true
63+
lang-version: 1.16
6064

6165
issues:
6266
exclude-rules:

‎CONTRIBUTING.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ For imports you should use the following format (_without_ the comments)
141141
```go
142142
import (
143143
// stdlib
144-
"encoding/json"
145144
"fmt"
145+
"math"
146146

147147
// local packages
148148
"code.gitea.io/gitea/models"

‎Dockerfile‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
2-
###################################
3-
#Build stage - temporarily using techknowlogick image until we upgrade to latest official alpine/go image
4-
FROM techknowlogick/go:1.17-alpine3.13 AS build-env
1+
#Build stage
2+
FROM golang:1.17-alpine3.15 AS build-env
53

64
ARG GOPROXY
75
ENV GOPROXY ${GOPROXY:-direct}
@@ -25,7 +23,7 @@ RUN if [ -n "${GITEA_VERSION}" ]; then git checkout "${GITEA_VERSION}"; fi \
2523
# Begin env-to-ini build
2624
RUN go build contrib/environment-to-ini/environment-to-ini.go
2725

28-
FROM alpine:3.13
26+
FROM alpine:3.15
2927
LABEL maintainer="[email protected]"
3028

3129
EXPOSE 22 3000

‎Dockerfile.rootless‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
2-
###################################
3-
#Build stage - temporarily using techknowlogick image until we upgrade to latest official alpine/go image
4-
FROM techknowlogick/go:1.17-alpine3.13 AS build-env
1+
#Build stage
2+
FROM golang:1.17-alpine3.15 AS build-env
53

64
ARG GOPROXY
75
ENV GOPROXY ${GOPROXY:-direct}
@@ -25,7 +23,7 @@ RUN if [ -n "${GITEA_VERSION}" ]; then git checkout "${GITEA_VERSION}"; fi \
2523
# Begin env-to-ini build
2624
RUN go build contrib/environment-to-ini/environment-to-ini.go
2725

28-
FROM alpine:3.13
26+
FROM alpine:3.15
2927
LABEL maintainer="[email protected]"
3028

3129
EXPOSE 2222 3000

‎Makefile‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,10 @@ clean:
231231

232232
.PHONY: fmt
233233
fmt:
234-
@echo "Running gitea-fmt(with gofmt)..."
235-
@$(GO) run build/code-batch-process.go gitea-fmt -s -w '{file-list}'
234+
@hash xgogofumpt > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
235+
$(GO) install mvdan.cc/gofumpt@latest; \
236+
fi
237+
gofumpt -w -l -extra -lang 1.16 .
236238

237239
.PHONY: vet
238240
vet:

‎build/code-batch-process.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ func (fc *fileCollector) collectFiles() (res [][]string, err error) {
136136
}
137137

138138
// substArgFiles expands the {file-list} to a real file list for commands
139-
func substArgFiles(args []string, files []string) []string {
139+
func substArgFiles(args, files []string) []string {
140140
for i, s := range args {
141141
if s == "{file-list}" {
142142
newArgs := append(args[:i], files...)

‎build/codeformat/formatimports.go‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ var importPackageGroupOrders = map[string]int{
2020

2121
var errInvalidCommentBetweenImports = errors.New("comments between imported packages are invalid, please move comments to the end of the package line")
2222

23-
var importBlockBegin = []byte("\nimport (\n")
24-
var importBlockEnd = []byte("\n)")
23+
var (
24+
importBlockBegin = []byte("\nimport (\n")
25+
importBlockEnd = []byte("\n)")
26+
)
2527

2628
type importLineParsed struct {
2729
group string
@@ -59,8 +61,10 @@ func parseImportLine(line string) (*importLineParsed, error) {
5961
return il, nil
6062
}
6163

62-
type importLineGroup []*importLineParsed
63-
type importLineGroupMap map[string]importLineGroup
64+
type (
65+
importLineGroup []*importLineParsed
66+
importLineGroupMap map[string]importLineGroup
67+
)
6468

6569
func formatGoImports(contentBytes []byte) ([]byte, error) {
6670
p1 := bytes.Index(contentBytes, importBlockBegin)
@@ -153,7 +157,7 @@ func formatGoImports(contentBytes []byte) ([]byte, error) {
153157
return formattedBytes, nil
154158
}
155159

156-
//FormatGoImports format the imports by our rules (see unit tests)
160+
// FormatGoImports format the imports by our rules (see unit tests)
157161
func FormatGoImports(file string) error {
158162
f, err := os.Open(file)
159163
if err != nil {
@@ -177,7 +181,7 @@ func FormatGoImports(file string) error {
177181
if bytes.Equal(contentBytes, formattedBytes) {
178182
return nil
179183
}
180-
f, err = os.OpenFile(file, os.O_TRUNC|os.O_WRONLY, 0644)
184+
f, err = os.OpenFile(file, os.O_TRUNC|os.O_WRONLY, 0o644)
181185
if err != nil {
182186
return err
183187
}

‎build/generate-bindata.go‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"github.com/shurcooL/vfsgen"
2121
)
2222

23-
func needsUpdate(dir string, filename string) (bool, []byte) {
23+
func needsUpdate(dir, filename string) (bool, []byte) {
2424
needRegen := false
2525
_, err := os.Stat(filename)
2626
if err != nil {
@@ -50,7 +50,6 @@ func needsUpdate(dir string, filename string) (bool, []byte) {
5050
newHash := hasher.Sum([]byte{})
5151

5252
if bytes.Compare(oldHash, newHash) != 0 {
53-
5453
return true, newHash
5554
}
5655

@@ -87,5 +86,5 @@ func main() {
8786
if err != nil {
8887
log.Fatalf("%v\n", err)
8988
}
90-
_ = os.WriteFile(filename+".hash", newHash, 0666)
89+
_ = os.WriteFile(filename+".hash", newHash, 0o666)
9190
}

‎build/generate-emoji.go‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ const (
3030
maxUnicodeVersion = 12
3131
)
3232

33-
var (
34-
flagOut = flag.String("o", "modules/emoji/emoji_data.go", "out")
35-
)
33+
var flagOut = flag.String("o", "modules/emoji/emoji_data.go", "out")
3634

3735
// Gemoji is a set of emoji data.
3836
type Gemoji []Emoji
@@ -68,7 +66,7 @@ func main() {
6866
}
6967

7068
// write
71-
err = os.WriteFile(*flagOut, buf, 0644)
69+
err = os.WriteFile(*flagOut, buf, 0o644)
7270
if err != nil {
7371
log.Fatal(err)
7472
}
@@ -109,7 +107,7 @@ func generate() ([]byte, error) {
109107
return nil, err
110108
}
111109

112-
var skinTones = make(map[string]string)
110+
skinTones := make(map[string]string)
113111

114112
skinTones["\U0001f3fb"] = "Light Skin Tone"
115113
skinTones["\U0001f3fc"] = "Medium-Light Skin Tone"
@@ -119,7 +117,7 @@ func generate() ([]byte, error) {
119117

120118
var tmp Gemoji
121119

122-
//filter out emoji that require greater than max unicode version
120+
// filter out emoji that require greater than max unicode version
123121
for i := range data {
124122
val, _ := strconv.ParseFloat(data[i].UnicodeVersion, 64)
125123
if int(val) <= maxUnicodeVersion {
@@ -158,7 +156,7 @@ func generate() ([]byte, error) {
158156

159157
// write a JSON file to use with tribute (write before adding skin tones since we can't support them there yet)
160158
file, _ := json.Marshal(data)
161-
_ = os.WriteFile("assets/emoji.json", file, 0644)
159+
_ = os.WriteFile("assets/emoji.json", file, 0o644)
162160

163161
// Add skin tones to emoji that support it
164162
var (

0 commit comments

Comments
 (0)