Skip to content

Commit 00e2f6b

Browse files
authored
chore: improve golangci-lint.yml, upgrade dependencies, and optimize code and comments (#4025)
1 parent b7c74c9 commit 00e2f6b

File tree

84 files changed

+611
-621
lines changed

Some content is hidden

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

84 files changed

+611
-621
lines changed

.github/workflows/golangci-lint.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@ on:
1515
- enhance/**
1616
- fix/**
1717
- feat/**
18+
pull_request:
19+
branches:
20+
- master
21+
- develop
22+
- personal/**
23+
- feature/**
24+
- enhance/**
25+
- fix/**
26+
- feat/**
1827

1928
jobs:
2029
golangci:
@@ -33,11 +42,11 @@ jobs:
3342
- name: golangci-lint
3443
uses: golangci/golangci-lint-action@v6
3544
with:
36-
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
45+
# Required: specify the golangci-lint version without the patch version to always use the latest patch.
3746
version: v1.62.2
3847
only-new-issues: true
3948
github-token: ${{ secrets.GITHUB_TOKEN }}
40-
args: --timeout 3m0s --fix
49+
args: --timeout 3m0s
4150
- name: Install gci
4251
run: go install github.com/daixiang0/gci@latest
4352
- name: Run gci
@@ -55,6 +64,8 @@ jobs:
5564
-s "prefix(github.com/gogf/gf/example)" \
5665
./
5766
- name: Check for changes
67+
# Check if the event is a push or a pull request from a forked repository
68+
if: github.event_name == 'push'|| (github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == true)
5869
run: |
5970
if [[ -n "$(git status --porcelain)" ]]; then
6071
echo "HAS_CHANGES=true" >> $GITHUB_ENV

.github/workflows/sonarcloud.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ concurrency:
1212
cancel-in-progress: true
1313

1414
# Declare default permissions as read only.
15-
permissions: read-all
15+
permissions: read
1616

1717
jobs:
1818
analysis:
@@ -34,7 +34,7 @@ jobs:
3434
persist-credentials: false
3535

3636
- name: "Run analysis"
37-
uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1
37+
uses: ossf/scorecard-action@v2.4.0 # v2.4.0
3838
with:
3939
results_file: results.sarif
4040
results_format: sarif

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ tidy:
1313

1414
.PHONY: lint
1515
lint:
16-
golangci-lint run
16+
golangci-lint run -c .golangci.yml
1717

1818
# make version to=v2.4.0
1919
.PHONY: version

README.MD

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
<div align=center>
3-
<img src="https://goframe.org/img/logo_full.png" width="300"/>
3+
<img src="https://goframe.org/img/logo_full.png" width="300" alt="goframe gf logo"/>
44

55
[![Go Reference](https://pkg.go.dev/badge/github.com/gogf/gf/v2.svg)](https://pkg.go.dev/github.com/gogf/gf/v2)
66
[![GoFrame CI](https://github.com/gogf/gf/actions/workflows/ci-main.yml/badge.svg)](https://github.com/gogf/gf/actions/workflows/ci-main.yml)
@@ -36,7 +36,7 @@ A powerful framework for faster, easier, and more efficient project development.
3636
💖 [Thanks to all the contributors who made GoFrame possible](https://github.com/gogf/gf/graphs/contributors) 💖
3737

3838
<a href="https://github.com/gogf/gf/graphs/contributors">
39-
<img src="https://goframe.org/img/contributors.svg?version=v2.8.2" />
39+
<img src="https://goframe.org/img/contributors.svg?version=v2.8.2" alt="goframe contributors"/>
4040
</a>
4141

4242
# License

cmd/gf/gfcmd/gfcmd.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// If a copy of the MIT was not distributed with this file,
55
// You can obtain one at https://github.com/gogf/gf.
66

7+
// Package gfcmd provides the management of CLI commands for `gf` tool.
78
package gfcmd
89

910
import (
@@ -25,9 +26,7 @@ import (
2526
"github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog"
2627
)
2728

28-
const (
29-
cliFolderName = `hack`
30-
)
29+
const cliFolderName = `hack`
3130

3231
// Command manages the CLI command of `gf`.
3332
// This struct can be globally accessible and extended with custom struct.

cmd/gf/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/gogf/gf/cmd/gf/v2
22

3-
go 1.18
3+
go 1.20
44

55
require (
66
github.com/gogf/gf/contrib/drivers/clickhouse/v2 v2.8.2

cmd/gf/go.work

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
go 1.18
1+
go 1.20
22

33
use (
44
./

cmd/gf/internal/cmd/cmd.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// If a copy of the MIT was not distributed with this file,
55
// You can obtain one at https://github.com/gogf/gf.
66

7+
// Package cmd provides the management of CLI commands for `gf` tool.
78
package cmd
89

910
import (
@@ -19,9 +20,8 @@ import (
1920
"github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog"
2021
)
2122

22-
var (
23-
GF = cGF{}
24-
)
23+
// GF is the management object for `gf` command line tool.
24+
var GF = cGF{}
2525

2626
type cGF struct {
2727
g.Meta `name:"gf" ad:"{cGFAd}"`

cmd/gf/main.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ import (
1616

1717
func main() {
1818
var (
19-
ctx = gctx.GetInitCtx()
19+
ctx = gctx.GetInitCtx()
20+
command, err = gfcmd.GetCommand(ctx)
2021
)
21-
command, err := gfcmd.GetCommand(ctx)
22+
2223
if err != nil {
2324
mlog.Fatalf(`%+v`, err)
2425
}

contrib/config/apollo/go.mod

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ require (
1111
github.com/BurntSushi/toml v1.4.0 // indirect
1212
github.com/clbanning/mxj/v2 v2.7.0 // indirect
1313
github.com/emirpasic/gods v1.18.1 // indirect
14-
github.com/fatih/color v1.17.0 // indirect
14+
github.com/fatih/color v1.18.0 // indirect
1515
github.com/fsnotify/fsnotify v1.7.0 // indirect
1616
github.com/go-logr/logr v1.4.2 // indirect
1717
github.com/go-logr/stdr v1.2.2 // indirect
1818
github.com/gorilla/websocket v1.5.3 // indirect
1919
github.com/grokify/html-strip-tags-go v0.1.0 // indirect
2020
github.com/hashicorp/hcl v1.0.0 // indirect
21-
github.com/magiconair/properties v1.8.7 // indirect
21+
github.com/magiconair/properties v1.8.9 // indirect
2222
github.com/mattn/go-colorable v0.1.13 // indirect
2323
github.com/mattn/go-isatty v0.0.20 // indirect
24-
github.com/mattn/go-runewidth v0.0.15 // indirect
24+
github.com/mattn/go-runewidth v0.0.16 // indirect
2525
github.com/mitchellh/mapstructure v1.4.1 // indirect
2626
github.com/olekukonko/tablewriter v0.0.5 // indirect
2727
github.com/pelletier/go-toml v1.9.3 // indirect
@@ -36,9 +36,9 @@ require (
3636
go.opentelemetry.io/otel/metric v1.24.0 // indirect
3737
go.opentelemetry.io/otel/sdk v1.24.0 // indirect
3838
go.opentelemetry.io/otel/trace v1.24.0 // indirect
39-
golang.org/x/net v0.27.0 // indirect
40-
golang.org/x/sys v0.22.0 // indirect
41-
golang.org/x/text v0.16.0 // indirect
39+
golang.org/x/net v0.32.0 // indirect
40+
golang.org/x/sys v0.28.0 // indirect
41+
golang.org/x/text v0.21.0 // indirect
4242
gopkg.in/ini.v1 v1.62.0 // indirect
4343
gopkg.in/yaml.v2 v2.4.0 // indirect
4444
gopkg.in/yaml.v3 v3.0.1 // indirect

0 commit comments

Comments
 (0)