Skip to content

Commit 26ded22

Browse files
committed
Merge remote-tracking branch 'origin/dev' into test
2 parents d67c7e2 + 670aa32 commit 26ded22

File tree

196 files changed

+789
-756
lines changed

Some content is hidden

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

196 files changed

+789
-756
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ vendor/
2828
/answer-data/
2929
/answer
3030
/new_answer
31-
31+
build/tools/
3232
dist/
3333

3434
# Lint setup generated file

.golangci.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
version: "2"
19+
linters:
20+
exclusions:
21+
paths:
22+
- answer-data
23+
- ui
24+
- i18n
25+
enable:
26+
- asasalint # checks for pass []any as any in variadic func(...any)
27+
- asciicheck # checks that your code does not contain non-ASCII identifiers
28+
- bidichk # checks for dangerous unicode character sequences
29+
- bodyclose # checks whether HTTP response body is closed successfully
30+
- canonicalheader # checks whether net/http.Header uses canonical header
31+
- copyloopvar # detects places where loop variables are copied (Go 1.22+)
32+
- gocritic # provides diagnostics that check for bugs, performance and style issues
33+
- misspell # finds commonly misspelled English words in comments and strings
34+
- modernize # detects code that can be modernized to use newer Go features
35+
- testifylint # checks usage of github.com/stretchr/testify
36+
- unconvert # removes unnecessary type conversions
37+
- unparam # reports unused function parameters
38+
- whitespace # detects leading and trailing whitespace
39+
40+
formatters:
41+
enable:
42+
- gofmt
43+
- goimports
44+
settings:
45+
gofmt:
46+
simplify: true
47+
rewrite-rules:
48+
- pattern: 'interface{}'
49+
replacement: 'any'

Makefile

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@ Revision=$(shell git rev-parse --short HEAD 2>/dev/null || echo "")
1010
GO_FLAGS=-ldflags="-X github.com/apache/answer/cmd.Version=$(VERSION) -X 'github.com/apache/answer/cmd.Revision=$(Revision)' -X 'github.com/apache/answer/cmd.Time=`date +%s`' -extldflags -static"
1111
GO=$(GO_ENV) "$(shell which go)"
1212

13+
GOLANGCI_VERSION ?= v2.6.2
14+
TOOLS_BIN := $(shell mkdir -p build/tools && realpath build/tools)
15+
16+
GOLANGCI = $(TOOLS_BIN)/golangci-lint-$(GOLANGCI_VERSION)
17+
$(GOLANGCI):
18+
rm -f $(TOOLS_BIN)/golangci-lint*
19+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/$(GOLANGCI_VERSION)/install.sh | sh -s -- -b $(TOOLS_BIN) $(GOLANGCI_VERSION)
20+
mv $(TOOLS_BIN)/golangci-lint $(TOOLS_BIN)/golangci-lint-$(GOLANGCI_VERSION)
21+
1322
build: generate
1423
@$(GO) build $(GO_FLAGS) -o $(BIN) $(DIR_SRC)
1524

@@ -50,8 +59,12 @@ install-ui-packages:
5059
ui:
5160
@cd ui && pnpm pre-install && pnpm build && cd -
5261

53-
lint: generate
62+
lint: generate $(GOLANGCI)
63+
@bash ./script/check-asf-header.sh
64+
$(GOLANGCI) run
65+
66+
lint-fix: generate $(GOLANGCI)
5467
@bash ./script/check-asf-header.sh
55-
@gofmt -w -l .
68+
$(GOLANGCI) run --fix
5669

5770
all: clean build

cmd/wire.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//go:build wireinject
2-
// +build wireinject
32

43
/*
54
* Licensed to the Apache Software Foundation (ASF) under one
@@ -32,7 +31,7 @@ import (
3231
"github.com/apache/answer/internal/base/server"
3332
"github.com/apache/answer/internal/base/translator"
3433
"github.com/apache/answer/internal/controller"
35-
"github.com/apache/answer/internal/controller/template_render"
34+
templaterender "github.com/apache/answer/internal/controller/template_render"
3635
"github.com/apache/answer/internal/controller_admin"
3736
"github.com/apache/answer/internal/repo"
3837
"github.com/apache/answer/internal/router"

docs/docs.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8080,9 +8080,6 @@ const docTemplate = `{
80808080
"id": {
80818081
"type": "string"
80828082
},
8083-
"question_id": {
8084-
"type": "string"
8085-
},
80868083
"title": {
80878084
"type": "string"
80888085
}
@@ -10920,7 +10917,7 @@ const docTemplate = `{
1092010917
},
1092110918
"theme_config": {
1092210919
"type": "object",
10923-
"additionalProperties": true
10920+
"additionalProperties": {}
1092410921
}
1092510922
}
1092610923
},
@@ -10935,7 +10932,7 @@ const docTemplate = `{
1093510932
},
1093610933
"theme_config": {
1093710934
"type": "object",
10938-
"additionalProperties": true
10935+
"additionalProperties": {}
1093910936
},
1094010937
"theme_options": {
1094110938
"type": "array",

docs/swagger.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8053,9 +8053,6 @@
80538053
"id": {
80548054
"type": "string"
80558055
},
8056-
"question_id": {
8057-
"type": "string"
8058-
},
80598056
"title": {
80608057
"type": "string"
80618058
}
@@ -10893,7 +10890,7 @@
1089310890
},
1089410891
"theme_config": {
1089510892
"type": "object",
10896-
"additionalProperties": true
10893+
"additionalProperties": {}
1089710894
}
1089810895
}
1089910896
},
@@ -10908,7 +10905,7 @@
1090810905
},
1090910906
"theme_config": {
1091010907
"type": "object",
10911-
"additionalProperties": true
10908+
"additionalProperties": {}
1091210909
},
1091310910
"theme_options": {
1091410911
"type": "array",

docs/swagger.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -399,8 +399,6 @@ definitions:
399399
type: string
400400
id:
401401
type: string
402-
question_id:
403-
type: string
404402
title:
405403
type: string
406404
required:
@@ -2364,7 +2362,7 @@ definitions:
23642362
maxLength: 255
23652363
type: string
23662364
theme_config:
2367-
additionalProperties: true
2365+
additionalProperties: {}
23682366
type: object
23692367
required:
23702368
- theme
@@ -2376,7 +2374,7 @@ definitions:
23762374
theme:
23772375
type: string
23782376
theme_config:
2379-
additionalProperties: true
2377+
additionalProperties: {}
23802378
type: object
23812379
theme_options:
23822380
items:

i18n/cs_CZ.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ backend:
234234
other: Nemáte oprávnění pro aktualizaci.
235235
content_cannot_empty:
236236
other: Content cannot be empty.
237-
content_less_than_minumum:
237+
content_less_than_minimum:
238238
other: Not enough content entered.
239239
rank:
240240
fail_to_meet_the_condition:

i18n/cy_GB.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ backend:
234234
other: Dim caniatâd i ddiweddaru.
235235
content_cannot_empty:
236236
other: Content cannot be empty.
237-
content_less_than_minumum:
237+
content_less_than_minimum:
238238
other: Not enough content entered.
239239
rank:
240240
fail_to_meet_the_condition:

i18n/da_DK.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ backend:
234234
other: Ingen tilladelse til at opdatere.
235235
content_cannot_empty:
236236
other: Content cannot be empty.
237-
content_less_than_minumum:
237+
content_less_than_minimum:
238238
other: Not enough content entered.
239239
rank:
240240
fail_to_meet_the_condition:

0 commit comments

Comments
 (0)