Skip to content

Commit 02a9efc

Browse files
committed
Merge branch 'master' of github.com:gogf/gf into feat/gdb-sharding
2 parents 114abbf + e18331a commit 02a9efc

File tree

208 files changed

+640
-518
lines changed

Some content is hidden

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

208 files changed

+640
-518
lines changed

.github/workflows/ci-main.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ for file in `find . -name go.mod`; do
4949

5050
# package example needs golang >= v1.20
5151
if [ "example" = $(basename $dirpath) ]; then
52-
if ! go version|grep -qE "go1.[2-9][0-9]"; then
52+
if ! go version|grep -qE "go1.[2-9][1-9]"; then
5353
echo "ignore example as go version: $(go version)"
5454
continue 1
5555
fi

.github/workflows/ci-main.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ jobs:
225225
- name: Install Protoc
226226
uses: arduino/setup-protoc@v2
227227
with:
228-
version: "23.x"
228+
version: "29.x"
229229
repo-token: ${{ secrets.GITHUB_TOKEN }}
230230

231231
- name: Install the protocol compiler plugins for Go

.github/workflows/doc-build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Set Up Golang Environment
2323
uses: actions/setup-go@v5
2424
with:
25-
go-version: 1.22.5
25+
go-version: 1.23.4
2626
cache: false
2727
- name: download goframe docs
2828
run: ./download.sh

.github/workflows/golangci-lint.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
golangci:
2828
strategy:
2929
matrix:
30-
go-version: [ '1.20','1.21.4','1.22', '1.23' ]
30+
go-version: [ '1.20','1.21.4','1.22','1.23' ]
3131
name: golangci-lint
3232
runs-on: ubuntu-latest
3333
steps:
@@ -41,5 +41,5 @@ jobs:
4141
uses: golangci/golangci-lint-action@v6
4242
with:
4343
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
44-
version: v1.60.1
45-
args: --timeout 3m0s
44+
version: v1.62.2
45+
args: --timeout 3m0s

.github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: Set Up Golang Environment
2222
uses: actions/setup-go@v5
2323
with:
24-
go-version: 1.22.5
24+
go-version: 1.23.4
2525

2626
- name: Build CLI Binary
2727
run: |

.golangci.yml

+48-15
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,11 @@ linters:
4040
- errcheck # Errcheck is a program for checking for unchecked errors in go programs.
4141
- errchkjson # Checks types passed to the JSON encoding functions. Reports unsupported types and optionally reports occasions, where the check for the returned error can be omitted.
4242
- funlen # Tool for detection of long functions
43+
- gofmt # Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification
44+
- goimports # Check import statements are formatted according to the 'goimport' command. Reformat imports in autofix mode.
45+
- gci # Gci controls Go package import order and makes it always deterministic.
4346
- goconst # Finds repeated strings that could be replaced by a constant
4447
- gocritic # Provides diagnostics that check for bugs, performance and style issues.
45-
- gofmt # Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification
4648
- gosimple # Linter for Go source code that specializes in simplifying code
4749
- govet # Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string
4850
- misspell # Finds commonly misspelled English words in comments
@@ -79,7 +81,51 @@ linters-settings:
7981
locale: US
8082
ignore-words:
8183
- cancelled
82-
84+
# https://golangci-lint.run/usage/linters/#gofmt
85+
gofmt:
86+
# Simplify code: gofmt with `-s` option.
87+
# Default: true
88+
simplify: true
89+
# Apply the rewrite rules to the source before reformatting.
90+
# https://pkg.go.dev/cmd/gofmt
91+
# Default: []
92+
rewrite-rules: [ ]
93+
# - pattern: 'interface{}'
94+
# replacement: 'any'
95+
# - pattern: 'a[b:len(a)]'
96+
# replacement: 'a[b:]'
97+
goimports:
98+
# A comma-separated list of prefixes, which, if set, checks import paths
99+
# with the given prefixes are grouped after 3rd-party packages.
100+
# Default: ""
101+
local-prefixes: github.com/gogf/gf/v2
102+
gci:
103+
# Section configuration to compare against.
104+
# Section names are case-insensitive and may contain parameters in ().
105+
# The default order of sections is `standard > default > custom > blank > dot > alias > localmodule`,
106+
# If `custom-order` is `true`, it follows the order of `sections` option.
107+
# Default: ["standard", "default"]
108+
sections:
109+
- standard # Standard section: captures all standard packages.
110+
- blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled.
111+
- default # Default section: contains all imports that could not be matched to another section type.
112+
- dot # Dot section: contains all dot imports. This section is not present unless explicitly enabled.
113+
# - alias # Alias section: contains all alias imports. This section is not present unless explicitly enabled.
114+
# - localmodule # Local module section: contains all local packages. This section is not present unless explicitly enabled.
115+
- prefix(github.com/gogf/gf) # Custom section: groups all imports with the specified Prefix.
116+
- prefix(github.com/gogf/gf/cmd) # Custom section: groups all imports with the specified Prefix.
117+
- prefix(github.com/gogf/gfcontrib) # Custom section: groups all imports with the specified Prefix.
118+
- prefix(github.com/gogf/gf/example) # Custom section: groups all imports with the specified Prefix.
119+
# Skip generated files.
120+
# Default: true
121+
skip-generated: true
122+
# Enable custom order of sections.
123+
# If `true`, make the section order the same as the order of `sections`.
124+
# Default: false
125+
custom-order: true
126+
# Drops lexical ordering for custom sections.
127+
# Default: false
128+
no-lex-order: true
83129
# https://golangci-lint.run/usage/linters/#revive
84130
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md
85131
revive:
@@ -259,16 +305,3 @@ linters-settings:
259305
# Default: ["*"]
260306
checks: [ "all","-SA1019","-SA4015","-SA1029","-SA1016","-SA9003","-SA4006","-SA6003" ]
261307

262-
# https://golangci-lint.run/usage/linters/#gofmt
263-
gofmt:
264-
# Simplify code: gofmt with `-s` option.
265-
# Default: true
266-
simplify: true
267-
# Apply the rewrite rules to the source before reformatting.
268-
# https://pkg.go.dev/cmd/gofmt
269-
# Default: []
270-
rewrite-rules: [ ]
271-
# - pattern: 'interface{}'
272-
# replacement: 'any'
273-
# - pattern: 'a[b:len(a)]'
274-
# replacement: 'a[b:]'

cmd/gf/gfcmd/gfcmd.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import (
1010
"context"
1111
"runtime"
1212

13+
_ "github.com/gogf/gf/cmd/gf/v2/internal/packed"
14+
1315
"github.com/gogf/gf/v2/errors/gcode"
1416
"github.com/gogf/gf/v2/errors/gerror"
1517
"github.com/gogf/gf/v2/frame/g"
@@ -19,7 +21,6 @@ import (
1921
"github.com/gogf/gf/v2/text/gstr"
2022

2123
"github.com/gogf/gf/cmd/gf/v2/internal/cmd"
22-
_ "github.com/gogf/gf/cmd/gf/v2/internal/packed"
2324
"github.com/gogf/gf/cmd/gf/v2/internal/utility/allyes"
2425
"github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog"
2526
)

cmd/gf/internal/cmd/cmd_doc.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@ import (
1616
"path/filepath"
1717
"time"
1818

19-
"github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog"
2019
"github.com/gogf/gf/v2/encoding/gcompress"
2120
"github.com/gogf/gf/v2/frame/g"
2221
"github.com/gogf/gf/v2/os/gfile"
22+
23+
"github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog"
2324
)
2425

2526
const (

cmd/gf/internal/cmd/cmd_fix.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ package cmd
99
import (
1010
"context"
1111

12-
"github.com/gogf/gf/v2/os/gproc"
13-
"github.com/gogf/gf/v2/text/gregex"
14-
15-
"github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog"
1612
"github.com/gogf/gf/v2/errors/gerror"
1713
"github.com/gogf/gf/v2/frame/g"
1814
"github.com/gogf/gf/v2/os/gfile"
15+
"github.com/gogf/gf/v2/os/gproc"
16+
"github.com/gogf/gf/v2/text/gregex"
1917
"github.com/gogf/gf/v2/text/gstr"
18+
19+
"github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog"
2020
)
2121

2222
var (

cmd/gf/internal/cmd/cmd_init.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,17 @@ import (
1212
"os"
1313
"strings"
1414

15-
"github.com/gogf/gf/cmd/gf/v2/internal/utility/allyes"
16-
"github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog"
17-
"github.com/gogf/gf/cmd/gf/v2/internal/utility/utils"
1815
"github.com/gogf/gf/v2/frame/g"
1916
"github.com/gogf/gf/v2/os/gcmd"
2017
"github.com/gogf/gf/v2/os/gfile"
2118
"github.com/gogf/gf/v2/os/gproc"
2219
"github.com/gogf/gf/v2/os/gres"
2320
"github.com/gogf/gf/v2/text/gstr"
2421
"github.com/gogf/gf/v2/util/gtag"
22+
23+
"github.com/gogf/gf/cmd/gf/v2/internal/utility/allyes"
24+
"github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog"
25+
"github.com/gogf/gf/cmd/gf/v2/internal/utility/utils"
2526
)
2627

2728
var (

cmd/gf/internal/cmd/cmd_up.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@ import (
1313

1414
"github.com/gogf/selfupdate"
1515

16-
"github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog"
17-
"github.com/gogf/gf/cmd/gf/v2/internal/utility/utils"
1816
"github.com/gogf/gf/v2/container/gset"
1917
"github.com/gogf/gf/v2/frame/g"
2018
"github.com/gogf/gf/v2/os/gfile"
2119
"github.com/gogf/gf/v2/os/gproc"
2220
"github.com/gogf/gf/v2/text/gstr"
2321
"github.com/gogf/gf/v2/util/gtag"
22+
23+
"github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog"
24+
"github.com/gogf/gf/cmd/gf/v2/internal/utility/utils"
2425
)
2526

2627
var (

cmd/gf/internal/cmd/cmd_z_unit_gen_ctrl_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ import (
1010
"path/filepath"
1111
"testing"
1212

13-
"github.com/gogf/gf/cmd/gf/v2/internal/cmd/genctrl"
1413
"github.com/gogf/gf/v2/os/gfile"
1514
"github.com/gogf/gf/v2/test/gtest"
1615
"github.com/gogf/gf/v2/util/guid"
1716
"github.com/gogf/gf/v2/util/gutil"
17+
18+
"github.com/gogf/gf/cmd/gf/v2/internal/cmd/genctrl"
1819
)
1920

2021
func Test_Gen_Ctrl_Default(t *testing.T) {

cmd/gf/internal/cmd/cmd_z_unit_gen_dao_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
"path/filepath"
1212
"testing"
1313

14-
"github.com/gogf/gf/cmd/gf/v2/internal/cmd/gendao"
1514
"github.com/gogf/gf/v2/database/gdb"
1615
"github.com/gogf/gf/v2/frame/g"
1716
"github.com/gogf/gf/v2/os/gcfg"
@@ -20,6 +19,8 @@ import (
2019
"github.com/gogf/gf/v2/text/gstr"
2120
"github.com/gogf/gf/v2/util/guid"
2221
"github.com/gogf/gf/v2/util/gutil"
22+
23+
"github.com/gogf/gf/cmd/gf/v2/internal/cmd/gendao"
2324
)
2425

2526
func Test_Gen_Dao_Default(t *testing.T) {

cmd/gf/internal/cmd/cmd_z_unit_gen_pb_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ import (
1010
"path/filepath"
1111
"testing"
1212

13-
"github.com/gogf/gf/cmd/gf/v2/internal/cmd/genpb"
1413
"github.com/gogf/gf/v2/os/gfile"
1514
"github.com/gogf/gf/v2/test/gtest"
1615
"github.com/gogf/gf/v2/text/gstr"
1716
"github.com/gogf/gf/v2/util/guid"
17+
18+
"github.com/gogf/gf/cmd/gf/v2/internal/cmd/genpb"
1819
)
1920

2021
func TestGenPbIssue3882(t *testing.T) {

cmd/gf/internal/cmd/cmd_z_unit_gen_pbentity_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@ import (
1111
"path/filepath"
1212
"testing"
1313

14-
"github.com/gogf/gf/cmd/gf/v2/internal/cmd/genpbentity"
1514
"github.com/gogf/gf/v2/os/gfile"
1615
"github.com/gogf/gf/v2/test/gtest"
1716
"github.com/gogf/gf/v2/text/gstr"
1817
"github.com/gogf/gf/v2/util/guid"
1918
"github.com/gogf/gf/v2/util/gutil"
19+
20+
"github.com/gogf/gf/cmd/gf/v2/internal/cmd/genpbentity"
2021
)
2122

2223
func Test_Gen_Pbentity_Default(t *testing.T) {

cmd/gf/internal/cmd/cmd_z_unit_gen_service_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ import (
1010
"path/filepath"
1111
"testing"
1212

13-
"github.com/gogf/gf/cmd/gf/v2/internal/cmd/genservice"
1413
"github.com/gogf/gf/v2/os/gfile"
1514
"github.com/gogf/gf/v2/test/gtest"
1615
"github.com/gogf/gf/v2/util/guid"
1716
"github.com/gogf/gf/v2/util/gutil"
17+
18+
"github.com/gogf/gf/cmd/gf/v2/internal/cmd/genservice"
1819
)
1920

2021
func Test_Gen_Service_Default(t *testing.T) {

cmd/gf/internal/cmd/genctrl/genctrl_calculate.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@
77
package genctrl
88

99
import (
10-
"github.com/gogf/gf/cmd/gf/v2/internal/utility/utils"
1110
"github.com/gogf/gf/v2/os/gfile"
1211
"github.com/gogf/gf/v2/text/gregex"
1312
"github.com/gogf/gf/v2/text/gstr"
13+
14+
"github.com/gogf/gf/cmd/gf/v2/internal/utility/utils"
1415
)
1516

1617
func (c CGenCtrl) getApiItemsInSrc(apiModuleFolderPath string) (items []apiItem, err error) {

cmd/gf/internal/cmd/genctrl/genctrl_generate_ctrl.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@ import (
1111
"path/filepath"
1212
"strings"
1313

14-
"github.com/gogf/gf/cmd/gf/v2/internal/consts"
15-
"github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog"
1614
"github.com/gogf/gf/v2/container/gset"
1715
"github.com/gogf/gf/v2/frame/g"
1816
"github.com/gogf/gf/v2/os/gfile"
1917
"github.com/gogf/gf/v2/text/gstr"
18+
19+
"github.com/gogf/gf/cmd/gf/v2/internal/consts"
20+
"github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog"
2021
)
2122

2223
type controllerGenerator struct{}

cmd/gf/internal/cmd/genctrl/genctrl_generate_ctrl_clear.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ package genctrl
99
import (
1010
"fmt"
1111

12-
"github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog"
1312
"github.com/gogf/gf/v2/os/gfile"
1413
"github.com/gogf/gf/v2/text/gstr"
14+
15+
"github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog"
1516
)
1617

1718
type controllerClearer struct{}

cmd/gf/internal/cmd/genctrl/genctrl_generate_interface.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,16 @@ import (
1010
"fmt"
1111
"path/filepath"
1212

13-
"github.com/gogf/gf/cmd/gf/v2/internal/consts"
14-
"github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog"
15-
"github.com/gogf/gf/cmd/gf/v2/internal/utility/utils"
1613
"github.com/gogf/gf/v2/container/gmap"
1714
"github.com/gogf/gf/v2/container/gset"
1815
"github.com/gogf/gf/v2/frame/g"
1916
"github.com/gogf/gf/v2/os/gfile"
2017
"github.com/gogf/gf/v2/text/gstr"
2118
"github.com/gogf/gf/v2/util/gconv"
19+
20+
"github.com/gogf/gf/cmd/gf/v2/internal/consts"
21+
"github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog"
22+
"github.com/gogf/gf/cmd/gf/v2/internal/utility/utils"
2223
)
2324

2425
type apiInterfaceGenerator struct{}

cmd/gf/internal/cmd/genctrl/genctrl_generate_sdk.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@ import (
1010
"fmt"
1111
"path/filepath"
1212

13-
"github.com/gogf/gf/cmd/gf/v2/internal/consts"
14-
"github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog"
1513
"github.com/gogf/gf/v2/container/gset"
1614
"github.com/gogf/gf/v2/frame/g"
1715
"github.com/gogf/gf/v2/os/gfile"
1816
"github.com/gogf/gf/v2/text/gregex"
1917
"github.com/gogf/gf/v2/text/gstr"
18+
19+
"github.com/gogf/gf/cmd/gf/v2/internal/consts"
20+
"github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog"
2021
)
2122

2223
type apiSdkGenerator struct{}

cmd/gf/internal/cmd/gendao/gendao.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313

1414
"golang.org/x/mod/modfile"
1515

16-
"github.com/gogf/gf/cmd/gf/v2/internal/utility/utils"
1716
"github.com/gogf/gf/v2/container/garray"
1817
"github.com/gogf/gf/v2/database/gdb"
1918
"github.com/gogf/gf/v2/frame/g"
@@ -24,6 +23,7 @@ import (
2423
"github.com/gogf/gf/v2/util/gtag"
2524

2625
"github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog"
26+
"github.com/gogf/gf/cmd/gf/v2/internal/utility/utils"
2727
)
2828

2929
const (

0 commit comments

Comments
 (0)