Skip to content

Commit eec47db

Browse files
committed
chore: quick update fix/err_codes at 2025-12-30 23:50:10
1 parent 4304e45 commit eec47db

File tree

42 files changed

+406
-354
lines changed

Some content is hidden

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

42 files changed

+406
-354
lines changed
File renamed without changes.

assert/aaa.go

Lines changed: 0 additions & 7 deletions
This file was deleted.

assert/assert.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import (
77
"github.com/k0kubun/pp/v3"
88
)
99

10+
const Name = "assert"
11+
1012
func Assert(b bool, format string, a ...any) {
1113
if b {
1214
must(fmt.Errorf(format, a...))

assert/must_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import (
77

88
"github.com/stretchr/testify/assert"
99

10+
"github.com/pubgo/funk/v2/debugs"
11+
1012
"github.com/pubgo/funk/v2/errors/errparser"
1113

1214
assert1 "github.com/pubgo/funk/v2/assert"
@@ -60,7 +62,7 @@ func init1Next() (err error) {
6062
}
6163

6264
func TestDebugMode(t *testing.T) {
63-
assert1.Exit(assert1.FeatureDebugMode.Set("true"))
65+
assert1.Exit(debugs.Enabled.Set("true"))
6466
assert1.Must(fmt.Errorf("test next"))
6567
}
6668

assert/util.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import (
1010
"github.com/k0kubun/pp/v3"
1111
"github.com/samber/lo"
1212

13+
"github.com/pubgo/funk/v2/debugs"
14+
1315
"github.com/pubgo/funk/v2/log/logfields"
1416
"github.com/pubgo/funk/v2/stack"
1517
)
@@ -69,7 +71,7 @@ func must(err error, messageArgs ...any) {
6971

7072
logErr(err, message, attrs...)
7173

72-
if FeatureDebugMode.Value() {
74+
if debugs.Enabled.Value() {
7375
_, _ = pp.Println(err)
7476
debug.PrintStack()
7577
}

async/go.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ func logErr(fn any, err error) {
124124
return
125125
}
126126

127-
if running.Debug() {
127+
if running.Debug.Value() {
128128
debug.PrintStack()
129129
errors.DebugPrint(err)
130130
}

buildinfo/build.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,3 @@ var (
2424
// project, project name
2525
project string
2626
)
27-
28-
// release tag
29-
var release string

buildinfo/version.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ func init() {
5858
_ = v.SetBuildTime(buildTime)
5959
_ = v.SetCommitID(commitID)
6060
_ = v.SetProject(project)
61-
_ = v.SetReleaseVersion(release)
6261
_ = v.SetMainPath(mainPath)
6362
_ = v.SetVersion(version)
6463
_ = v.SetDomain(domain)

buildinfo/version/version.go

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package version
22

3-
import "github.com/pubgo/funk/v2"
3+
import (
4+
"github.com/pubgo/funk/v2"
5+
)
46

57
var (
68
mainPath string
@@ -9,16 +11,14 @@ var (
911
buildTime string
1012
version string
1113
project string
12-
release string
1314
)
1415

15-
func CommitID() string { return commitID }
16-
func MainPath() string { return mainPath }
17-
func Version() string { return version }
18-
func ReleaseVersion() string { return release }
19-
func BuildTime() string { return buildTime }
20-
func Project() string { return project }
21-
func Domain() string { return domain }
16+
func CommitID() string { return commitID }
17+
func MainPath() string { return mainPath }
18+
func Version() string { return version }
19+
func BuildTime() string { return buildTime }
20+
func Project() string { return project }
21+
func Domain() string { return domain }
2222

2323
func SetCommitID(id string) funk.Void {
2424
if id != "" {
@@ -41,13 +41,6 @@ func SetVersion(v string) funk.Void {
4141
return funk.Void{}
4242
}
4343

44-
func SetReleaseVersion(r string) funk.Void {
45-
if r != "" {
46-
release = r
47-
}
48-
return funk.Void{}
49-
}
50-
5144
func SetBuildTime(t string) funk.Void {
5245
if t != "" {
5346
buildTime = t

cmds/configcmd/cmd.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@ import (
44
"context"
55
"fmt"
66

7-
"github.com/urfave/cli/v3"
7+
"github.com/pubgo/redant"
88
yaml "gopkg.in/yaml.v3"
99

1010
"github.com/pubgo/funk/v2/assert"
1111
"github.com/pubgo/funk/v2/config"
1212
"github.com/pubgo/funk/v2/recovery"
1313
)
1414

15-
func New[Cfg any]() *cli.Command {
16-
return &cli.Command{
17-
Name: "config",
18-
Usage: "config management",
19-
Commands: []*cli.Command{
15+
func New[Cfg any]() *redant.Command {
16+
return &redant.Command{
17+
Use: "config",
18+
Short: "config management",
19+
Children: []*redant.Command{
2020
{
21-
Name: "show",
22-
Description: "show config data",
23-
Action: func(ctx context.Context, command *cli.Command) error {
21+
Use: "show",
22+
Short: "show config data",
23+
Handler: func(ctx context.Context, i *redant.Invocation) error {
2424
defer recovery.Exit()
2525
fmt.Println("config path:\n", config.GetConfigPath())
2626
fmt.Println("config raw data:\n", string(assert.Must1(yaml.Marshal(config.Load[Cfg]().T))))

0 commit comments

Comments
 (0)