diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 781d0ff0c..29bcc1dd7 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -8,7 +8,7 @@ on: pull_request: branches: [master, develop] env: - GF_DEBUG: 1 + GF_DEBUG: 0 jobs: code-test: diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d11a3c960..000000000 --- a/.travis.yml +++ /dev/null @@ -1,50 +0,0 @@ -os: linux -arch: arm64-graviton2 - -language: go - -go: - - "1.14.x" - - "1.15.x" - - "1.16.x" - -branches: - only: - - master - - develop - - staging - -env: -- TZ=Asia/Shanghai GF_DEBUG=1 GO111MODULE=on - -services: -- mysql -- redis-server -- postgresql - -addons: - postgresql: "9.4" - hosts: - - local - -before_install: - - mysql -e 'CREATE DATABASE IF NOT EXISTS test;' - -install: -- cat /etc/hosts - -before_script: -- find . -name "*.go" | xargs gofmt -w -- git diff --name-only --exit-code || exit 1 -- echo "UPDATE mysql.user SET authentication_string=PASSWORD('12345678') WHERE user='root';\nFLUSH PRIVILEGES;\n" | mysql -u root -- psql -c 'create database travis_ci_test;' -U postgres - -script: -- GOARCH=386 go test -v ./... || exit 1 -- GOARCH=amd64 go test -v ./... -race -coverprofile=coverage.txt -covermode=atomic - -after_success: -- bash <(curl -s https://codecov.io/bash) - - - diff --git a/README.MD b/README.MD index 7eee0b379..38c7aeb28 100644 --- a/README.MD +++ b/README.MD @@ -64,7 +64,7 @@ The `Web` component performance of `GoFrame`, please refer to third-party projec - [ZTE](https://www.zte.com.cn/china/) - [Ant Financial Services](https://www.antfin.com/) - [VIVO](https://www.vivo.com/) -- [MedLinker](https://www.vivo.com/) +- [MedLinker](https://www.medlinker.com/) - [KuCoin](https://www.kucoin.io/) - [LeYouJia](https://www.leyoujia.com/) - [IGG](https://igg.com) diff --git a/database/gdb/gdb_z_mysql_model_test.go b/database/gdb/gdb_z_mysql_model_test.go index dc2cf59c2..66482520e 100644 --- a/database/gdb/gdb_z_mysql_model_test.go +++ b/database/gdb/gdb_z_mysql_model_test.go @@ -2159,13 +2159,17 @@ func Test_Model_FieldsEx(t *testing.T) { } func Test_Model_FieldsEx_WithReservedWords(t *testing.T) { - table := "fieldsex_test_table" - sqlTpcPath := gdebug.TestDataPath("reservedwords_table_tpl.sql") - if _, err := db.Exec(ctx, fmt.Sprintf(gfile.GetContents(sqlTpcPath), table)); err != nil { - gtest.Error(err) - } - defer dropTable(table) gtest.C(t, func(t *gtest.T) { + var ( + table = "fieldsex_test_table" + sqlTpcPath = gdebug.TestDataPath("reservedwords_table_tpl.sql") + sqlContent = gfile.GetContents(sqlTpcPath) + ) + t.AssertNE(sqlContent, "") + if _, err := db.Exec(ctx, fmt.Sprintf(sqlContent, table)); err != nil { + t.AssertNil(err) + } + defer dropTable(table) _, err := db.Model(table).FieldsEx("content").One() t.AssertNil(err) }) diff --git a/debug/gdebug/gdebug_caller.go b/debug/gdebug/gdebug_caller.go index 70bb1a28f..62133837a 100644 --- a/debug/gdebug/gdebug_caller.go +++ b/debug/gdebug/gdebug_caller.go @@ -14,8 +14,6 @@ import ( "reflect" "runtime" "strings" - - "github.com/gogf/gf/v2/internal/utils" ) const ( @@ -35,7 +33,7 @@ func init() { goRootForFilter = strings.Replace(goRootForFilter, "\\", "/", -1) } // Initialize internal package variable: selfPath. - selfPath, _ := exec.LookPath(os.Args[0]) + selfPath, _ = exec.LookPath(os.Args[0]) if selfPath != "" { selfPath, _ = filepath.Abs(selfPath) } @@ -69,7 +67,7 @@ func CallerWithFilter(filter string, skip ...int) (function string, path string, pc, file, line, ok = runtime.Caller(i) } if ok { - function := "" + function = "" if fn := runtime.FuncForPC(pc); fn == nil { function = "unknown" } else { @@ -102,14 +100,8 @@ func callerFromIndex(filters []string) (pc uintptr, file string, line int, index if filtered { continue } - if !utils.IsDebugEnabled() { - if strings.Contains(file, utils.StackFilterKeyForGoFrame) { - continue - } - } else { - if strings.Contains(file, stackFilterKey) { - continue - } + if strings.Contains(file, stackFilterKey) { + continue } if index > 0 { index-- diff --git a/debug/gdebug/gdebug_stack.go b/debug/gdebug/gdebug_stack.go index 2a70b542e..ffcfd7b6c 100644 --- a/debug/gdebug/gdebug_stack.go +++ b/debug/gdebug/gdebug_stack.go @@ -11,8 +11,6 @@ import ( "fmt" "runtime" "strings" - - "github.com/gogf/gf/v2/internal/utils" ) // PrintStack prints to standard error the stack trace returned by runtime.Stack. @@ -82,14 +80,8 @@ func StackWithFilters(filters []string, skip ...int) string { continue } - if !utils.IsDebugEnabled() { - if strings.Contains(file, utils.StackFilterKeyForGoFrame) { - continue - } - } else { - if strings.Contains(file, stackFilterKey) { - continue - } + if strings.Contains(file, stackFilterKey) { + continue } if fn := runtime.FuncForPC(pc); fn == nil { diff --git a/errors/gerror/gerror_error.go b/errors/gerror/gerror_error.go index 55111edab..e0f27bb4d 100644 --- a/errors/gerror/gerror_error.go +++ b/errors/gerror/gerror_error.go @@ -15,7 +15,6 @@ import ( "strings" "github.com/gogf/gf/v2/errors/gcode" - "github.com/gogf/gf/v2/internal/utils" ) // Error is custom error for additional features. @@ -201,14 +200,8 @@ func formatSubStack(st stack, buffer *bytes.Buffer) { if fn := runtime.FuncForPC(p - 1); fn != nil { file, line := fn.FileLine(p - 1) // Custom filtering. - if !utils.IsDebugEnabled() { - if strings.Contains(file, utils.StackFilterKeyForGoFrame) { - continue - } - } else { - if strings.Contains(file, stackFilterKeyLocal) { - continue - } + if strings.Contains(file, stackFilterKeyLocal) { + continue } // Avoid stack string like "`autogenerated`" if strings.Contains(file, "<") { diff --git a/internal/utils/utils_debug.go b/internal/utils/utils_debug.go index 6b46503bd..0b2fc17e6 100644 --- a/internal/utils/utils_debug.go +++ b/internal/utils/utils_debug.go @@ -16,7 +16,7 @@ const ( // StackFilterKeyForGoFrame is the stack filtering key for all GoFrame module paths. // Eg: .../pkg/mod/github.com/gogf/gf/v2@v2.0.0-20211011134327-54dd11f51122/debug/gdebug/gdebug_caller.go - StackFilterKeyForGoFrame = "github.com/gogf/gf/v" + StackFilterKeyForGoFrame = "github.com/gogf/gf/" ) var (