gogf / gf

@@ -18,7 +18,7 @@
Loading
18 18
	"github.com/gogf/gf/v2/debug/gdebug"
19 19
	"github.com/gogf/gf/v2/errors/gcode"
20 20
	"github.com/gogf/gf/v2/errors/gerror"
21 -
	"github.com/gogf/gf/v2/internal/utils"
21 +
	"github.com/gogf/gf/v2/internal/consts"
22 22
	"github.com/gogf/gf/v2/net/goai"
23 23
	"github.com/gogf/gf/v2/text/gregex"
24 24
	"github.com/gogf/gf/v2/text/gstr"
@@ -88,7 +88,7 @@
Loading
88 88
	}
89 89
	handler.Id = handlerIdGenerator.Add(1)
90 90
	if handler.Source == "" {
91 -
		_, file, line := gdebug.CallerWithFilter([]string{utils.StackFilterKeyForGoFrame})
91 +
		_, file, line := gdebug.CallerWithFilter([]string{consts.StackFilterKeyForGoFrame})
92 92
		handler.Source = fmt.Sprintf(`%s:%d`, file, line)
93 93
	}
94 94
	domain, method, uri, err := s.parsePattern(pattern)

@@ -17,7 +17,7 @@
Loading
17 17
	"time"
18 18
19 19
	"github.com/fatih/color"
20 -
	"github.com/gogf/gf/v2/internal/utils"
20 +
	"github.com/gogf/gf/v2/internal/consts"
21 21
	"go.opentelemetry.io/otel/trace"
22 22
23 23
	"github.com/gogf/gf/v2/container/gtype"
@@ -163,7 +163,7 @@
Loading
163 163
	// Caller path and Fn name.
164 164
	if l.config.Flags&(F_FILE_LONG|F_FILE_SHORT|F_CALLER_FN) > 0 {
165 165
		callerFnName, path, line := gdebug.CallerWithFilter(
166 -
			[]string{utils.StackFilterKeyForGoFrame},
166 +
			[]string{consts.StackFilterKeyForGoFrame},
167 167
			l.config.StSkip,
168 168
		)
169 169
		if l.config.Flags&F_CALLER_FN > 0 {

@@ -15,7 +15,7 @@
Loading
15 15
16 16
const (
17 17
	// maxStackDepth marks the max stack depth for error back traces.
18 -
	maxStackDepth = 32
18 +
	maxStackDepth = 64
19 19
)
20 20
21 21
// Cause returns the root cause error of `err`.

@@ -12,8 +12,8 @@
Loading
12 12
	"reflect"
13 13
14 14
	"github.com/gogf/gf/v2/debug/gdebug"
15 +
	"github.com/gogf/gf/v2/internal/consts"
15 16
	"github.com/gogf/gf/v2/internal/reflection"
16 -
	"github.com/gogf/gf/v2/internal/utils"
17 17
	"github.com/gogf/gf/v2/text/gstr"
18 18
	"github.com/gogf/gf/v2/util/gconv"
19 19
)
@@ -263,7 +263,7 @@
Loading
263 263
264 264
// preBindToLocalArray adds the route registering parameters to an internal variable array for lazily registering feature.
265 265
func (g *RouterGroup) preBindToLocalArray(bindType string, pattern string, object interface{}, params ...interface{}) *RouterGroup {
266 -
	_, file, line := gdebug.CallerWithFilter([]string{utils.StackFilterKeyForGoFrame})
266 +
	_, file, line := gdebug.CallerWithFilter([]string{consts.StackFilterKeyForGoFrame})
267 267
	preBindItems = append(preBindItems, &preBindItem{
268 268
		group:    g,
269 269
		bindType: bindType,

@@ -13,10 +13,6 @@
Loading
13 13
const (
14 14
	// Debug key for checking if in debug mode.
15 15
	commandEnvKeyForDebugKey = "gf.debug"
16 -
17 -
	// StackFilterKeyForGoFrame is the stack filtering key for all GoFrame module paths.
18 -
	// Eg: .../pkg/mod/github.com/gogf/gf/v2@v2.0.0-20211011134327-54dd11f51122/debug/gdebug/gdebug_caller.go
19 -
	StackFilterKeyForGoFrame = "github.com/gogf/gf/"
20 16
)
21 17
22 18
var (

@@ -33,11 +33,8 @@
Loading
33 33
func (m *Model) TableFields(tableStr string, schema ...string) (fields map[string]*TableField, err error) {
34 34
	var (
35 35
		table      = m.db.GetCore().guessPrimaryTableName(tableStr)
36 -
		usedSchema = m.schema
36 +
		usedSchema = gutil.GetOrDefaultStr(m.schema, schema...)
37 37
	)
38 -
	if len(schema) > 0 && schema[0] != "" {
39 -
		usedSchema = schema[0]
40 -
	}
41 38
	return m.db.TableFields(m.GetCtx(), table, usedSchema)
42 39
}
43 40

@@ -12,6 +12,8 @@
Loading
12 12
	"io"
13 13
	"runtime"
14 14
	"strings"
15 +
16 +
	"github.com/gogf/gf/v2/internal/consts"
15 17
)
16 18
17 19
// Format formats the frame according to the fmt.Formatter interface.
@@ -52,9 +54,16 @@
Loading
52 54
	for _, p := range st {
53 55
		if fn := runtime.FuncForPC(p - 1); fn != nil {
54 56
			file, line := fn.FileLine(p - 1)
55 -
			// Custom filtering.
56 -
			if strings.Contains(file, stackFilterKeyLocal) {
57 -
				continue
57 +
			if isUsingBriefStack {
58 +
				// filter whole GoFrame packages stack paths.
59 +
				if strings.Contains(file, consts.StackFilterKeyForGoFrame) {
60 +
					continue
61 +
				}
62 +
			} else {
63 +
				// package path stack filtering.
64 +
				if strings.Contains(file, stackFilterKeyLocal) {
65 +
					continue
66 +
				}
58 67
			}
59 68
			// Avoid stack string like "`autogenerated`"
60 69
			if strings.Contains(file, "<") {

@@ -13,6 +13,7 @@
Loading
13 13
14 14
import (
15 15
	"github.com/gogf/gf/v2/errors/gcode"
16 +
	"github.com/gogf/gf/v2/internal/command"
16 17
)
17 18
18 19
// IIs is the interface for Is feature.
@@ -56,3 +57,20 @@
Loading
56 57
	Error() string
57 58
	Unwrap() error
58 59
}
60 +
61 +
const (
62 +
	// commandEnvKeyForBrief is the command environment name for switch key for brief error stack.
63 +
	commandEnvKeyForBrief = "gf.gerror.brief"
64 +
)
65 +
66 +
var (
67 +
	// isUsingBriefStack is the switch key for brief error stack.
68 +
	isUsingBriefStack bool
69 +
)
70 +
71 +
func init() {
72 +
	value := command.GetOptWithEnv(commandEnvKeyForBrief)
73 +
	if value == "1" || value == "true" {
74 +
		isUsingBriefStack = true
75 +
	}
76 +
}
Files Coverage
container 95.54%
contrib 71.72%
crypto 80.10%
database 70.37%
debug/gdebug 53.26%
encoding 81.70%
errors 77.88%
frame 53.52%
i18n/gi18n 81.13%
internal 79.29%
net 64.38%
os 69.99%
test/gtest 56.64%
text 89.77%
util 77.34%
Project Totals (577 files) 76.58%
3132457241
go-1.17-386
3132457241
go-1.16-amd64
3132457241
go-1.17-amd64
3132457241
go-1.15-amd64
3132457241
go-1.15-386

No yaml found.

Create your codecov.yml to customize your Codecov experience

Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading