From b0b84a393761db30d68b17d176f1fb138dfd785a Mon Sep 17 00:00:00 2001 From: houseme Date: Sat, 7 Dec 2024 14:17:33 +0800 Subject: [PATCH] ci(gci/import): improve golangci.yml and add gci linter (#4010) --- .github/workflows/doc-build.yml | 2 +- .github/workflows/golangci-lint.yml | 6 +- .github/workflows/release.yml | 2 +- .golangci.yml | 63 ++++++++++++++----- cmd/gf/gfcmd/gfcmd.go | 3 +- cmd/gf/internal/cmd/cmd_doc.go | 3 +- cmd/gf/internal/cmd/cmd_fix.go | 8 +-- cmd/gf/internal/cmd/cmd_init.go | 7 ++- cmd/gf/internal/cmd/cmd_up.go | 5 +- .../internal/cmd/cmd_z_unit_gen_ctrl_test.go | 3 +- .../internal/cmd/cmd_z_unit_gen_dao_test.go | 3 +- cmd/gf/internal/cmd/cmd_z_unit_gen_pb_test.go | 3 +- .../cmd/cmd_z_unit_gen_pbentity_test.go | 3 +- .../cmd/cmd_z_unit_gen_service_test.go | 3 +- .../internal/cmd/genctrl/genctrl_calculate.go | 3 +- .../cmd/genctrl/genctrl_generate_ctrl.go | 5 +- .../genctrl/genctrl_generate_ctrl_clear.go | 3 +- .../cmd/genctrl/genctrl_generate_interface.go | 7 ++- .../cmd/genctrl/genctrl_generate_sdk.go | 5 +- cmd/gf/internal/cmd/gendao/gendao.go | 2 +- cmd/gf/internal/cmd/genenums/genenums.go | 5 +- .../internal/cmd/genenums/genenums_parser.go | 3 +- cmd/gf/internal/cmd/genpb/genpb.go | 3 +- cmd/gf/internal/cmd/genpb/genpb_controller.go | 3 +- cmd/gf/internal/cmd/genpb/genpb_tag.go | 3 +- .../internal/cmd/genpbentity/genpbentity.go | 7 ++- .../cmd/genservice/genservice_calculate.go | 3 +- .../cmd/genservice/genservice_generate.go | 7 ++- .../genservice_generate_template.go | 3 +- .../genservice/logic/article/article.go | 3 +- .../genservice/logic/article/article_extra.go | 5 +- .../issue/3835/logic/issue3835/issue3835.go | 1 + cmd/gf/internal/utility/utils/utils_test.go | 3 +- cmd/gf/main.go | 5 +- .../garray_z_example_normal_any_test.go | 3 +- .../garray_z_example_normal_int_test.go | 3 +- .../garray_z_example_normal_str_test.go | 3 +- .../garray_z_example_sorted_str_test.go | 3 +- .../garray/garray_z_unit_normal_any_test.go | 3 +- .../garray/garray_z_unit_normal_int_test.go | 3 +- .../garray/garray_z_unit_normal_str_test.go | 3 +- .../garray/garray_z_unit_sorted_any_test.go | 3 +- .../garray/garray_z_unit_sorted_int_test.go | 3 +- .../garray/garray_z_unit_sorted_str_test.go | 3 +- container/gmap/gmap_hash_any_any_map.go | 3 +- container/gmap/gmap_hash_int_any_map.go | 3 +- container/gtree/gtree_avltree.go | 1 + container/gtree/gtree_btree.go | 1 + container/gtree/gtree_redblacktree.go | 1 + contrib/config/consul/consul_test.go | 10 +-- contrib/config/kubecm/kubecm_test.go | 3 +- contrib/config/nacos/nacos_test.go | 3 +- .../clickhouse_z_unit_issue_test.go | 3 +- contrib/drivers/dm/dm_convert.go | 1 - contrib/drivers/dm/dm_do_filter.go | 1 - contrib/drivers/dm/dm_open.go | 1 - contrib/drivers/dm/dm_table_fields.go | 1 - .../drivers/mssql/mssql_z_unit_model_test.go | 3 +- .../mysql/mysql_z_unit_feature_with_test.go | 3 +- contrib/drivers/oracle/oracle_do_insert.go | 3 +- .../oracle/oracle_z_unit_basic_test.go | 3 +- contrib/drivers/pgsql/pgsql_convert.go | 3 +- contrib/drivers/pgsql/pgsql_do_filter.go | 1 + contrib/drivers/pgsql/pgsql_do_insert.go | 1 + .../drivers/pgsql/pgsql_z_unit_init_test.go | 4 +- .../drivers/pgsql/pgsql_z_unit_issue_test.go | 1 - .../otelmetric/otelmetric_z_unit_http_test.go | 3 +- .../otelmetric/otelmetric_z_unit_test.go | 3 +- contrib/nosql/redis/redis_z_group_set_test.go | 3 +- .../nosql/redis/redis_z_unit_config_test.go | 2 +- .../redis/redis_z_unit_gcache_adapter_test.go | 2 +- contrib/registry/etcd/etcd_z_test.go | 3 +- contrib/registry/file/file_z_basic_test.go | 3 +- contrib/registry/file/file_z_http_test.go | 3 +- contrib/registry/nacos/nacos.go | 9 +-- contrib/registry/nacos/nacos_discovery.go | 5 +- contrib/registry/nacos/nacos_register.go | 3 +- contrib/registry/nacos/nacos_service.go | 3 +- contrib/registry/nacos/nacos_watcher.go | 3 +- contrib/registry/nacos/nacos_z_test.go | 6 +- contrib/registry/zookeeper/zookeeper.go | 3 +- .../registry/zookeeper/zookeeper_registrar.go | 5 +- .../registry/zookeeper/zookeeper_watcher.go | 5 +- contrib/rpc/grpcx/grpcx_interceptor_client.go | 3 +- contrib/rpc/grpcx/grpcx_interceptor_server.go | 5 +- contrib/rpc/grpcx/grpcx_registry_file.go | 4 +- contrib/rpc/grpcx/grpcx_unit_z_ctx_test.go | 3 +- .../grpcx_unit_z_grpc_server_basic_test.go | 7 ++- contrib/rpc/grpcx/grpcx_unit_z_issue_test.go | 8 ++- .../internal/balancer/balancer_builder.go | 1 + .../tracing/tracing_interceptor_client.go | 3 +- .../tracing/tracing_interceptor_server.go | 3 +- .../httpclient_z_unit_feature_handler_test.go | 3 +- database/gdb/gdb_core_underlying.go | 3 +- debug/gdebug/gdebug_grid.go | 6 +- encoding/gcharset/gcharset.go | 16 +++-- encoding/ghtml/ghtml.go | 3 +- encoding/gurl/url.go | 2 +- errors/gerror/gerror_error.go | 6 +- errors/gerror/gerror_error_stack.go | 2 +- example/balancer/http/client/client.go | 3 +- example/balancer/http/server/server.go | 3 +- example/balancer/polaris/client/client.go | 3 +- example/balancer/polaris/server/server.go | 3 +- example/config/apollo/boot/boot.go | 3 +- example/config/consul/boot/boot.go | 4 +- example/config/kubecm/boot_in_pod/boot.go | 3 +- example/config/kubecm/boot_out_pod/boot.go | 3 +- example/config/nacos/boot/boot.go | 3 +- example/config/polaris/boot/boot.go | 3 +- .../driver-encrypt-decrypt-password/main.go | 3 +- example/metric/basic/main.go | 3 +- example/metric/callback/main.go | 3 +- example/metric/dynamic_attributes/main.go | 3 +- example/metric/global_attributes/main.go | 3 +- example/metric/http_client/main.go | 3 +- example/metric/http_server/main.go | 3 +- example/metric/meter_attributes/main.go | 3 +- example/nosql/redis/adapter/main.go | 4 +- example/registry/etcd/grpc/client/client.go | 8 ++- .../etcd/grpc/controller/helloworld.go | 1 + example/registry/etcd/grpc/server/server.go | 1 + example/registry/etcd/http/client/client.go | 3 +- example/registry/etcd/http/server/server.go | 3 +- example/registry/file/client/client.go | 3 +- example/registry/file/server/server.go | 3 +- example/registry/nacos/grpc/client/client.go | 8 ++- .../nacos/grpc/controller/helloworld.go | 1 + example/registry/nacos/grpc/server/server.go | 1 + example/registry/nacos/http/client/client.go | 3 +- example/registry/nacos/http/server/server.go | 3 +- example/registry/polaris/client/client.go | 3 +- example/registry/polaris/server/server.go | 3 +- example/rpc/grpcx/balancer/client/client.go | 6 +- .../grpcx/balancer/controller/helloworld.go | 1 + example/rpc/grpcx/balancer/server/server.go | 1 + example/rpc/grpcx/basic/client/client.go | 6 +- .../rpc/grpcx/basic/controller/helloworld.go | 1 + example/rpc/grpcx/basic/server/server.go | 1 + example/rpc/grpcx/ctx/client/client.go | 6 +- .../rpc/grpcx/ctx/controller/helloworld.go | 6 +- example/rpc/grpcx/ctx/server/server.go | 1 + example/rpc/grpcx/rawgrpc/client/client.go | 11 ++-- example/rpc/grpcx/rawgrpc/server/server.go | 6 +- example/rpc/grpcx/resolver/client/client.go | 8 ++- .../grpcx/resolver/controller/helloworld.go | 1 + example/rpc/grpcx/resolver/server/server.go | 1 + example/trace/grpc-with-db/client/client.go | 10 +-- example/trace/grpc-with-db/server/server.go | 16 ++--- example/trace/http-with-db/client/client.go | 3 +- example/trace/http-with-db/server/server.go | 4 +- example/trace/http/client/client.go | 3 +- example/trace/http/server/server.go | 3 +- example/trace/inprocess-grpc/main.go | 3 +- example/trace/inprocess/main.go | 3 +- example/trace/otlp/grpc/main.go | 4 +- example/trace/otlp/http/main.go | 3 +- example/trace/provider/grpc/main.go | 4 +- example/trace/provider/http/main.go | 3 +- i18n/gi18n/gi18n_z_unit_test.go | 8 +-- internal/errors/errors.go | 8 +-- internal/utils/utils_debug.go | 6 +- internal/utils/utils_is.go | 4 +- internal/utils/utils_str.go | 28 ++++----- net/ghttp/ghttp_z_unit_feature_https_test.go | 4 +- net/ghttp/ghttp_z_unit_feature_pprof_test.go | 3 +- .../ghttp_z_unit_feature_request_file_test.go | 3 +- .../ghttp_z_unit_feature_response_test.go | 5 +- net/gtrace/gtrace.go | 2 +- net/gtrace/gtrace_content.go | 1 - net/gtrace/gtrace_z_unit_test.go | 1 - os/gcache/gcache_adapter_memory_lru.go | 3 +- os/gcache/gcache_cache.go | 1 + os/gfsnotify/gfsnotify_watcher_loop.go | 4 +- os/gres/gres_z_unit_test.go | 4 +- os/gstructs/gstructs_field.go | 4 +- os/gstructs/gstructs_field_tag.go | 2 +- os/gtime/gtime.go | 4 +- os/gtimer/gtimer_entry.go | 3 +- util/grand/grand_buffer.go | 8 +-- util/gtag/gtag_enums.go | 6 +- util/gutil/gutil_z_example_test.go | 1 + 182 files changed, 436 insertions(+), 314 deletions(-) diff --git a/.github/workflows/doc-build.yml b/.github/workflows/doc-build.yml index 9ab2d274f..32d6f7d1a 100644 --- a/.github/workflows/doc-build.yml +++ b/.github/workflows/doc-build.yml @@ -22,7 +22,7 @@ jobs: - name: Set Up Golang Environment uses: actions/setup-go@v5 with: - go-version: 1.22.5 + go-version: 1.23.4 cache: false - name: download goframe docs run: ./download.sh diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 0aa08c049..567a5239a 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -27,7 +27,7 @@ jobs: golangci: strategy: matrix: - go-version: [ '1.20','1.21.4','1.22', '1.23' ] + go-version: [ '1.20','1.21.4','1.22','1.23' ] name: golangci-lint runs-on: ubuntu-latest steps: @@ -41,5 +41,5 @@ jobs: uses: golangci/golangci-lint-action@v6 with: # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. - version: v1.60.1 - args: --timeout 3m0s + version: v1.62.2 + args: --timeout 3m0s \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 819793388..b9729849c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,7 +21,7 @@ jobs: - name: Set Up Golang Environment uses: actions/setup-go@v5 with: - go-version: 1.22.5 + go-version: 1.23.4 - name: Build CLI Binary run: | diff --git a/.golangci.yml b/.golangci.yml index 35b2998c8..0ee2b141e 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -40,9 +40,11 @@ linters: - errcheck # Errcheck is a program for checking for unchecked errors in go programs. - 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. - funlen # Tool for detection of long functions + - gofmt # Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification + - goimports # Check import statements are formatted according to the 'goimport' command. Reformat imports in autofix mode. + - gci # Gci controls Go package import order and makes it always deterministic. - goconst # Finds repeated strings that could be replaced by a constant - gocritic # Provides diagnostics that check for bugs, performance and style issues. - - gofmt # Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification - gosimple # Linter for Go source code that specializes in simplifying code - govet # Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string - misspell # Finds commonly misspelled English words in comments @@ -79,7 +81,51 @@ linters-settings: locale: US ignore-words: - cancelled - + # https://golangci-lint.run/usage/linters/#gofmt + gofmt: + # Simplify code: gofmt with `-s` option. + # Default: true + simplify: true + # Apply the rewrite rules to the source before reformatting. + # https://pkg.go.dev/cmd/gofmt + # Default: [] + rewrite-rules: [ ] + # - pattern: 'interface{}' + # replacement: 'any' + # - pattern: 'a[b:len(a)]' + # replacement: 'a[b:]' + goimports: + # A comma-separated list of prefixes, which, if set, checks import paths + # with the given prefixes are grouped after 3rd-party packages. + # Default: "" + local-prefixes: github.com/gogf/gf/v2 + gci: + # Section configuration to compare against. + # Section names are case-insensitive and may contain parameters in (). + # The default order of sections is `standard > default > custom > blank > dot > alias > localmodule`, + # If `custom-order` is `true`, it follows the order of `sections` option. + # Default: ["standard", "default"] + sections: + - standard # Standard section: captures all standard packages. + - blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled. + - default # Default section: contains all imports that could not be matched to another section type. + - dot # Dot section: contains all dot imports. This section is not present unless explicitly enabled. + # - alias # Alias section: contains all alias imports. This section is not present unless explicitly enabled. + # - localmodule # Local module section: contains all local packages. This section is not present unless explicitly enabled. + - prefix(github.com/gogf/gf) # Custom section: groups all imports with the specified Prefix. + - prefix(github.com/gogf/gf/cmd) # Custom section: groups all imports with the specified Prefix. + - prefix(github.com/gogf/gfcontrib) # Custom section: groups all imports with the specified Prefix. + - prefix(github.com/gogf/gf/example) # Custom section: groups all imports with the specified Prefix. + # Skip generated files. + # Default: true + skip-generated: true + # Enable custom order of sections. + # If `true`, make the section order the same as the order of `sections`. + # Default: false + custom-order: true + # Drops lexical ordering for custom sections. + # Default: false + no-lex-order: true # https://golangci-lint.run/usage/linters/#revive # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md revive: @@ -259,16 +305,3 @@ linters-settings: # Default: ["*"] checks: [ "all","-SA1019","-SA4015","-SA1029","-SA1016","-SA9003","-SA4006","-SA6003" ] - # https://golangci-lint.run/usage/linters/#gofmt - gofmt: - # Simplify code: gofmt with `-s` option. - # Default: true - simplify: true - # Apply the rewrite rules to the source before reformatting. - # https://pkg.go.dev/cmd/gofmt - # Default: [] - rewrite-rules: [ ] - # - pattern: 'interface{}' - # replacement: 'any' - # - pattern: 'a[b:len(a)]' - # replacement: 'a[b:]' diff --git a/cmd/gf/gfcmd/gfcmd.go b/cmd/gf/gfcmd/gfcmd.go index 4a8dd0622..7e4b55336 100644 --- a/cmd/gf/gfcmd/gfcmd.go +++ b/cmd/gf/gfcmd/gfcmd.go @@ -10,6 +10,8 @@ import ( "context" "runtime" + _ "github.com/gogf/gf/cmd/gf/v2/internal/packed" + "github.com/gogf/gf/v2/errors/gcode" "github.com/gogf/gf/v2/errors/gerror" "github.com/gogf/gf/v2/frame/g" @@ -19,7 +21,6 @@ import ( "github.com/gogf/gf/v2/text/gstr" "github.com/gogf/gf/cmd/gf/v2/internal/cmd" - _ "github.com/gogf/gf/cmd/gf/v2/internal/packed" "github.com/gogf/gf/cmd/gf/v2/internal/utility/allyes" "github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog" ) diff --git a/cmd/gf/internal/cmd/cmd_doc.go b/cmd/gf/internal/cmd/cmd_doc.go index 78501a8a1..2f5a012cb 100644 --- a/cmd/gf/internal/cmd/cmd_doc.go +++ b/cmd/gf/internal/cmd/cmd_doc.go @@ -16,10 +16,11 @@ import ( "path/filepath" "time" - "github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog" "github.com/gogf/gf/v2/encoding/gcompress" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gfile" + + "github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog" ) const ( diff --git a/cmd/gf/internal/cmd/cmd_fix.go b/cmd/gf/internal/cmd/cmd_fix.go index 94276095e..479252a73 100644 --- a/cmd/gf/internal/cmd/cmd_fix.go +++ b/cmd/gf/internal/cmd/cmd_fix.go @@ -9,14 +9,14 @@ package cmd import ( "context" - "github.com/gogf/gf/v2/os/gproc" - "github.com/gogf/gf/v2/text/gregex" - - "github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog" "github.com/gogf/gf/v2/errors/gerror" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gfile" + "github.com/gogf/gf/v2/os/gproc" + "github.com/gogf/gf/v2/text/gregex" "github.com/gogf/gf/v2/text/gstr" + + "github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog" ) var ( diff --git a/cmd/gf/internal/cmd/cmd_init.go b/cmd/gf/internal/cmd/cmd_init.go index e7bf79fec..5b583345d 100644 --- a/cmd/gf/internal/cmd/cmd_init.go +++ b/cmd/gf/internal/cmd/cmd_init.go @@ -12,9 +12,6 @@ import ( "os" "strings" - "github.com/gogf/gf/cmd/gf/v2/internal/utility/allyes" - "github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog" - "github.com/gogf/gf/cmd/gf/v2/internal/utility/utils" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gcmd" "github.com/gogf/gf/v2/os/gfile" @@ -22,6 +19,10 @@ import ( "github.com/gogf/gf/v2/os/gres" "github.com/gogf/gf/v2/text/gstr" "github.com/gogf/gf/v2/util/gtag" + + "github.com/gogf/gf/cmd/gf/v2/internal/utility/allyes" + "github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog" + "github.com/gogf/gf/cmd/gf/v2/internal/utility/utils" ) var ( diff --git a/cmd/gf/internal/cmd/cmd_up.go b/cmd/gf/internal/cmd/cmd_up.go index 2bef38896..4a43e5b6a 100644 --- a/cmd/gf/internal/cmd/cmd_up.go +++ b/cmd/gf/internal/cmd/cmd_up.go @@ -13,14 +13,15 @@ import ( "github.com/gogf/selfupdate" - "github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog" - "github.com/gogf/gf/cmd/gf/v2/internal/utility/utils" "github.com/gogf/gf/v2/container/gset" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gfile" "github.com/gogf/gf/v2/os/gproc" "github.com/gogf/gf/v2/text/gstr" "github.com/gogf/gf/v2/util/gtag" + + "github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog" + "github.com/gogf/gf/cmd/gf/v2/internal/utility/utils" ) var ( diff --git a/cmd/gf/internal/cmd/cmd_z_unit_gen_ctrl_test.go b/cmd/gf/internal/cmd/cmd_z_unit_gen_ctrl_test.go index 1270cc674..55986b480 100644 --- a/cmd/gf/internal/cmd/cmd_z_unit_gen_ctrl_test.go +++ b/cmd/gf/internal/cmd/cmd_z_unit_gen_ctrl_test.go @@ -10,11 +10,12 @@ import ( "path/filepath" "testing" - "github.com/gogf/gf/cmd/gf/v2/internal/cmd/genctrl" "github.com/gogf/gf/v2/os/gfile" "github.com/gogf/gf/v2/test/gtest" "github.com/gogf/gf/v2/util/guid" "github.com/gogf/gf/v2/util/gutil" + + "github.com/gogf/gf/cmd/gf/v2/internal/cmd/genctrl" ) func Test_Gen_Ctrl_Default(t *testing.T) { diff --git a/cmd/gf/internal/cmd/cmd_z_unit_gen_dao_test.go b/cmd/gf/internal/cmd/cmd_z_unit_gen_dao_test.go index dd920b663..fbefdb88f 100644 --- a/cmd/gf/internal/cmd/cmd_z_unit_gen_dao_test.go +++ b/cmd/gf/internal/cmd/cmd_z_unit_gen_dao_test.go @@ -11,7 +11,6 @@ import ( "path/filepath" "testing" - "github.com/gogf/gf/cmd/gf/v2/internal/cmd/gendao" "github.com/gogf/gf/v2/database/gdb" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gcfg" @@ -20,6 +19,8 @@ import ( "github.com/gogf/gf/v2/text/gstr" "github.com/gogf/gf/v2/util/guid" "github.com/gogf/gf/v2/util/gutil" + + "github.com/gogf/gf/cmd/gf/v2/internal/cmd/gendao" ) func Test_Gen_Dao_Default(t *testing.T) { diff --git a/cmd/gf/internal/cmd/cmd_z_unit_gen_pb_test.go b/cmd/gf/internal/cmd/cmd_z_unit_gen_pb_test.go index 0f9e09137..4ba3c179d 100644 --- a/cmd/gf/internal/cmd/cmd_z_unit_gen_pb_test.go +++ b/cmd/gf/internal/cmd/cmd_z_unit_gen_pb_test.go @@ -10,11 +10,12 @@ import ( "path/filepath" "testing" - "github.com/gogf/gf/cmd/gf/v2/internal/cmd/genpb" "github.com/gogf/gf/v2/os/gfile" "github.com/gogf/gf/v2/test/gtest" "github.com/gogf/gf/v2/text/gstr" "github.com/gogf/gf/v2/util/guid" + + "github.com/gogf/gf/cmd/gf/v2/internal/cmd/genpb" ) func TestGenPbIssue3882(t *testing.T) { diff --git a/cmd/gf/internal/cmd/cmd_z_unit_gen_pbentity_test.go b/cmd/gf/internal/cmd/cmd_z_unit_gen_pbentity_test.go index 851dc2a7e..89770f5ba 100644 --- a/cmd/gf/internal/cmd/cmd_z_unit_gen_pbentity_test.go +++ b/cmd/gf/internal/cmd/cmd_z_unit_gen_pbentity_test.go @@ -11,12 +11,13 @@ import ( "path/filepath" "testing" - "github.com/gogf/gf/cmd/gf/v2/internal/cmd/genpbentity" "github.com/gogf/gf/v2/os/gfile" "github.com/gogf/gf/v2/test/gtest" "github.com/gogf/gf/v2/text/gstr" "github.com/gogf/gf/v2/util/guid" "github.com/gogf/gf/v2/util/gutil" + + "github.com/gogf/gf/cmd/gf/v2/internal/cmd/genpbentity" ) func Test_Gen_Pbentity_Default(t *testing.T) { diff --git a/cmd/gf/internal/cmd/cmd_z_unit_gen_service_test.go b/cmd/gf/internal/cmd/cmd_z_unit_gen_service_test.go index 8aeff4bb5..40ee7158e 100644 --- a/cmd/gf/internal/cmd/cmd_z_unit_gen_service_test.go +++ b/cmd/gf/internal/cmd/cmd_z_unit_gen_service_test.go @@ -10,11 +10,12 @@ import ( "path/filepath" "testing" - "github.com/gogf/gf/cmd/gf/v2/internal/cmd/genservice" "github.com/gogf/gf/v2/os/gfile" "github.com/gogf/gf/v2/test/gtest" "github.com/gogf/gf/v2/util/guid" "github.com/gogf/gf/v2/util/gutil" + + "github.com/gogf/gf/cmd/gf/v2/internal/cmd/genservice" ) func Test_Gen_Service_Default(t *testing.T) { diff --git a/cmd/gf/internal/cmd/genctrl/genctrl_calculate.go b/cmd/gf/internal/cmd/genctrl/genctrl_calculate.go index 3fb8825ad..db27022ee 100644 --- a/cmd/gf/internal/cmd/genctrl/genctrl_calculate.go +++ b/cmd/gf/internal/cmd/genctrl/genctrl_calculate.go @@ -7,10 +7,11 @@ package genctrl import ( - "github.com/gogf/gf/cmd/gf/v2/internal/utility/utils" "github.com/gogf/gf/v2/os/gfile" "github.com/gogf/gf/v2/text/gregex" "github.com/gogf/gf/v2/text/gstr" + + "github.com/gogf/gf/cmd/gf/v2/internal/utility/utils" ) func (c CGenCtrl) getApiItemsInSrc(apiModuleFolderPath string) (items []apiItem, err error) { diff --git a/cmd/gf/internal/cmd/genctrl/genctrl_generate_ctrl.go b/cmd/gf/internal/cmd/genctrl/genctrl_generate_ctrl.go index d966338f8..6c427462f 100644 --- a/cmd/gf/internal/cmd/genctrl/genctrl_generate_ctrl.go +++ b/cmd/gf/internal/cmd/genctrl/genctrl_generate_ctrl.go @@ -11,12 +11,13 @@ import ( "path/filepath" "strings" - "github.com/gogf/gf/cmd/gf/v2/internal/consts" - "github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog" "github.com/gogf/gf/v2/container/gset" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gfile" "github.com/gogf/gf/v2/text/gstr" + + "github.com/gogf/gf/cmd/gf/v2/internal/consts" + "github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog" ) type controllerGenerator struct{} diff --git a/cmd/gf/internal/cmd/genctrl/genctrl_generate_ctrl_clear.go b/cmd/gf/internal/cmd/genctrl/genctrl_generate_ctrl_clear.go index af328f8dd..fd493a73f 100644 --- a/cmd/gf/internal/cmd/genctrl/genctrl_generate_ctrl_clear.go +++ b/cmd/gf/internal/cmd/genctrl/genctrl_generate_ctrl_clear.go @@ -9,9 +9,10 @@ package genctrl import ( "fmt" - "github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog" "github.com/gogf/gf/v2/os/gfile" "github.com/gogf/gf/v2/text/gstr" + + "github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog" ) type controllerClearer struct{} diff --git a/cmd/gf/internal/cmd/genctrl/genctrl_generate_interface.go b/cmd/gf/internal/cmd/genctrl/genctrl_generate_interface.go index c678c0194..dfd9fab57 100644 --- a/cmd/gf/internal/cmd/genctrl/genctrl_generate_interface.go +++ b/cmd/gf/internal/cmd/genctrl/genctrl_generate_interface.go @@ -10,15 +10,16 @@ import ( "fmt" "path/filepath" - "github.com/gogf/gf/cmd/gf/v2/internal/consts" - "github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog" - "github.com/gogf/gf/cmd/gf/v2/internal/utility/utils" "github.com/gogf/gf/v2/container/gmap" "github.com/gogf/gf/v2/container/gset" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gfile" "github.com/gogf/gf/v2/text/gstr" "github.com/gogf/gf/v2/util/gconv" + + "github.com/gogf/gf/cmd/gf/v2/internal/consts" + "github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog" + "github.com/gogf/gf/cmd/gf/v2/internal/utility/utils" ) type apiInterfaceGenerator struct{} diff --git a/cmd/gf/internal/cmd/genctrl/genctrl_generate_sdk.go b/cmd/gf/internal/cmd/genctrl/genctrl_generate_sdk.go index b5a82afb6..1e79266b0 100644 --- a/cmd/gf/internal/cmd/genctrl/genctrl_generate_sdk.go +++ b/cmd/gf/internal/cmd/genctrl/genctrl_generate_sdk.go @@ -10,13 +10,14 @@ import ( "fmt" "path/filepath" - "github.com/gogf/gf/cmd/gf/v2/internal/consts" - "github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog" "github.com/gogf/gf/v2/container/gset" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gfile" "github.com/gogf/gf/v2/text/gregex" "github.com/gogf/gf/v2/text/gstr" + + "github.com/gogf/gf/cmd/gf/v2/internal/consts" + "github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog" ) type apiSdkGenerator struct{} diff --git a/cmd/gf/internal/cmd/gendao/gendao.go b/cmd/gf/internal/cmd/gendao/gendao.go index a19d0c5a1..d571aada6 100644 --- a/cmd/gf/internal/cmd/gendao/gendao.go +++ b/cmd/gf/internal/cmd/gendao/gendao.go @@ -13,7 +13,6 @@ import ( "golang.org/x/mod/modfile" - "github.com/gogf/gf/cmd/gf/v2/internal/utility/utils" "github.com/gogf/gf/v2/container/garray" "github.com/gogf/gf/v2/database/gdb" "github.com/gogf/gf/v2/frame/g" @@ -24,6 +23,7 @@ import ( "github.com/gogf/gf/v2/util/gtag" "github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog" + "github.com/gogf/gf/cmd/gf/v2/internal/utility/utils" ) const ( diff --git a/cmd/gf/internal/cmd/genenums/genenums.go b/cmd/gf/internal/cmd/genenums/genenums.go index b4c3b3d08..a214072c2 100644 --- a/cmd/gf/internal/cmd/genenums/genenums.go +++ b/cmd/gf/internal/cmd/genenums/genenums.go @@ -11,12 +11,13 @@ import ( "golang.org/x/tools/go/packages" - "github.com/gogf/gf/cmd/gf/v2/internal/consts" - "github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gfile" "github.com/gogf/gf/v2/text/gstr" "github.com/gogf/gf/v2/util/gtag" + + "github.com/gogf/gf/cmd/gf/v2/internal/consts" + "github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog" ) type ( diff --git a/cmd/gf/internal/cmd/genenums/genenums_parser.go b/cmd/gf/internal/cmd/genenums/genenums_parser.go index 66858a0dd..21b9f96d9 100644 --- a/cmd/gf/internal/cmd/genenums/genenums_parser.go +++ b/cmd/gf/internal/cmd/genenums/genenums_parser.go @@ -10,10 +10,11 @@ import ( "go/constant" "go/types" + "golang.org/x/tools/go/packages" + "github.com/gogf/gf/v2/encoding/gjson" "github.com/gogf/gf/v2/text/gstr" "github.com/gogf/gf/v2/util/gconv" - "golang.org/x/tools/go/packages" ) const pkgLoadMode = 0xffffff diff --git a/cmd/gf/internal/cmd/genpb/genpb.go b/cmd/gf/internal/cmd/genpb/genpb.go index 023cdb984..9167f28d2 100644 --- a/cmd/gf/internal/cmd/genpb/genpb.go +++ b/cmd/gf/internal/cmd/genpb/genpb.go @@ -9,11 +9,12 @@ package genpb import ( "context" - "github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gfile" "github.com/gogf/gf/v2/os/gproc" "github.com/gogf/gf/v2/util/gtag" + + "github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog" ) type ( diff --git a/cmd/gf/internal/cmd/genpb/genpb_controller.go b/cmd/gf/internal/cmd/genpb/genpb_controller.go index fdafe96d9..5c365902a 100644 --- a/cmd/gf/internal/cmd/genpb/genpb_controller.go +++ b/cmd/gf/internal/cmd/genpb/genpb_controller.go @@ -11,11 +11,12 @@ import ( "fmt" "strings" - "github.com/gogf/gf/cmd/gf/v2/internal/utility/utils" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gfile" "github.com/gogf/gf/v2/text/gregex" "github.com/gogf/gf/v2/text/gstr" + + "github.com/gogf/gf/cmd/gf/v2/internal/utility/utils" ) type generateControllerInput struct { diff --git a/cmd/gf/internal/cmd/genpb/genpb_tag.go b/cmd/gf/internal/cmd/genpb/genpb_tag.go index ac74e28eb..65a6c8ed7 100644 --- a/cmd/gf/internal/cmd/genpb/genpb_tag.go +++ b/cmd/gf/internal/cmd/genpb/genpb_tag.go @@ -10,13 +10,14 @@ import ( "context" "fmt" - "github.com/gogf/gf/cmd/gf/v2/internal/utility/utils" "github.com/gogf/gf/v2/container/gmap" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gfile" "github.com/gogf/gf/v2/text/gregex" "github.com/gogf/gf/v2/text/gstr" "github.com/gogf/gf/v2/util/gconv" + + "github.com/gogf/gf/cmd/gf/v2/internal/utility/utils" ) type generateStructTagInput struct { diff --git a/cmd/gf/internal/cmd/genpbentity/genpbentity.go b/cmd/gf/internal/cmd/genpbentity/genpbentity.go index 29a660b08..e7138850d 100644 --- a/cmd/gf/internal/cmd/genpbentity/genpbentity.go +++ b/cmd/gf/internal/cmd/genpbentity/genpbentity.go @@ -14,11 +14,8 @@ import ( "regexp" "strings" - "github.com/gogf/gf/cmd/gf/v2/internal/utility/utils" "github.com/olekukonko/tablewriter" - "github.com/gogf/gf/cmd/gf/v2/internal/consts" - "github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog" "github.com/gogf/gf/v2/container/garray" "github.com/gogf/gf/v2/database/gdb" "github.com/gogf/gf/v2/frame/g" @@ -29,6 +26,10 @@ import ( "github.com/gogf/gf/v2/text/gstr" "github.com/gogf/gf/v2/util/gconv" "github.com/gogf/gf/v2/util/gtag" + + "github.com/gogf/gf/cmd/gf/v2/internal/consts" + "github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog" + "github.com/gogf/gf/cmd/gf/v2/internal/utility/utils" ) type ( diff --git a/cmd/gf/internal/cmd/genservice/genservice_calculate.go b/cmd/gf/internal/cmd/genservice/genservice_calculate.go index 15f575c04..268585cb4 100644 --- a/cmd/gf/internal/cmd/genservice/genservice_calculate.go +++ b/cmd/gf/internal/cmd/genservice/genservice_calculate.go @@ -10,12 +10,13 @@ import ( "fmt" "strings" - "github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog" "github.com/gogf/gf/v2/container/garray" "github.com/gogf/gf/v2/container/gmap" "github.com/gogf/gf/v2/os/gfile" "github.com/gogf/gf/v2/text/gregex" "github.com/gogf/gf/v2/text/gstr" + + "github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog" ) func (c CGenService) calculateImportedItems( diff --git a/cmd/gf/internal/cmd/genservice/genservice_generate.go b/cmd/gf/internal/cmd/genservice/genservice_generate.go index a11d54e7f..cfb691ec7 100644 --- a/cmd/gf/internal/cmd/genservice/genservice_generate.go +++ b/cmd/gf/internal/cmd/genservice/genservice_generate.go @@ -10,13 +10,14 @@ import ( "bytes" "fmt" - "github.com/gogf/gf/cmd/gf/v2/internal/consts" - "github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog" - "github.com/gogf/gf/cmd/gf/v2/internal/utility/utils" "github.com/gogf/gf/v2/container/gmap" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gfile" "github.com/gogf/gf/v2/text/gstr" + + "github.com/gogf/gf/cmd/gf/v2/internal/consts" + "github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog" + "github.com/gogf/gf/cmd/gf/v2/internal/utility/utils" ) type generateServiceFilesInput struct { diff --git a/cmd/gf/internal/cmd/genservice/genservice_generate_template.go b/cmd/gf/internal/cmd/genservice/genservice_generate_template.go index 664ce699e..5947908d9 100644 --- a/cmd/gf/internal/cmd/genservice/genservice_generate_template.go +++ b/cmd/gf/internal/cmd/genservice/genservice_generate_template.go @@ -10,11 +10,12 @@ import ( "bytes" "fmt" - "github.com/gogf/gf/cmd/gf/v2/internal/consts" "github.com/gogf/gf/v2/container/gmap" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/text/gregex" "github.com/gogf/gf/v2/text/gstr" + + "github.com/gogf/gf/cmd/gf/v2/internal/consts" ) func (c CGenService) generatePackageImports(generatedContent *bytes.Buffer, packageName string, imports []string) { diff --git a/cmd/gf/internal/cmd/testdata/genservice/logic/article/article.go b/cmd/gf/internal/cmd/testdata/genservice/logic/article/article.go index 57b6a31a6..9ee049fab 100644 --- a/cmd/gf/internal/cmd/testdata/genservice/logic/article/article.go +++ b/cmd/gf/internal/cmd/testdata/genservice/logic/article/article.go @@ -11,8 +11,9 @@ import ( "go/ast" t "time" - "github.com/gogf/gf/cmd/gf/v2/internal/cmd/testdata/genservice/service" gdbalias "github.com/gogf/gf/v2/database/gdb" + + "github.com/gogf/gf/cmd/gf/v2/internal/cmd/testdata/genservice/service" ) type sArticle struct { diff --git a/cmd/gf/internal/cmd/testdata/genservice/logic/article/article_extra.go b/cmd/gf/internal/cmd/testdata/genservice/logic/article/article_extra.go index 165747407..3d9c3d0fa 100644 --- a/cmd/gf/internal/cmd/testdata/genservice/logic/article/article_extra.go +++ b/cmd/gf/internal/cmd/testdata/genservice/logic/article/article_extra.go @@ -14,12 +14,13 @@ package article import ( "context" - // This is a random comment - gdbas "github.com/gogf/gf/v2/database/gdb" /** * */ _ "github.com/gogf/gf/v2/os/gfile" + + // This is a random comment + gdbas "github.com/gogf/gf/v2/database/gdb" ) // T1 random comment diff --git a/cmd/gf/internal/cmd/testdata/issue/3835/logic/issue3835/issue3835.go b/cmd/gf/internal/cmd/testdata/issue/3835/logic/issue3835/issue3835.go index 888b5a994..f54e54b3a 100644 --- a/cmd/gf/internal/cmd/testdata/issue/3835/logic/issue3835/issue3835.go +++ b/cmd/gf/internal/cmd/testdata/issue/3835/logic/issue3835/issue3835.go @@ -4,6 +4,7 @@ import ( "context" "github.com/gogf/gf/cmd/gf/v2/internal/cmd/testdata/issue/3835/service" + "github.com/gogf/gf/contrib/drivers/mysql/v2" ) diff --git a/cmd/gf/internal/utility/utils/utils_test.go b/cmd/gf/internal/utility/utils/utils_test.go index 8fbbfc1dc..c7c30fc29 100644 --- a/cmd/gf/internal/utility/utils/utils_test.go +++ b/cmd/gf/internal/utility/utils/utils_test.go @@ -10,8 +10,9 @@ import ( "fmt" "testing" - "github.com/gogf/gf/cmd/gf/v2/internal/utility/utils" "github.com/gogf/gf/v2/test/gtest" + + "github.com/gogf/gf/cmd/gf/v2/internal/utility/utils" ) func Test_GetModPath(t *testing.T) { diff --git a/cmd/gf/main.go b/cmd/gf/main.go index 358c7d459..9021f656f 100644 --- a/cmd/gf/main.go +++ b/cmd/gf/main.go @@ -7,10 +7,11 @@ package main import ( - "github.com/gogf/gf/cmd/gf/v2/gfcmd" - "github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog" "github.com/gogf/gf/v2/errors/gerror" "github.com/gogf/gf/v2/os/gctx" + + "github.com/gogf/gf/cmd/gf/v2/gfcmd" + "github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog" ) func main() { diff --git a/container/garray/garray_z_example_normal_any_test.go b/container/garray/garray_z_example_normal_any_test.go index 545775719..a115fcacf 100644 --- a/container/garray/garray_z_example_normal_any_test.go +++ b/container/garray/garray_z_example_normal_any_test.go @@ -9,10 +9,9 @@ package garray_test import ( "fmt" - "github.com/gogf/gf/v2/internal/empty" - "github.com/gogf/gf/v2/container/garray" "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/internal/empty" ) func ExampleNew() { diff --git a/container/garray/garray_z_example_normal_int_test.go b/container/garray/garray_z_example_normal_int_test.go index 867a8ea6f..f60345540 100644 --- a/container/garray/garray_z_example_normal_int_test.go +++ b/container/garray/garray_z_example_normal_int_test.go @@ -9,10 +9,9 @@ package garray_test import ( "fmt" - "github.com/gogf/gf/v2/internal/empty" - "github.com/gogf/gf/v2/container/garray" "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/internal/empty" "github.com/gogf/gf/v2/internal/json" "github.com/gogf/gf/v2/util/gconv" ) diff --git a/container/garray/garray_z_example_normal_str_test.go b/container/garray/garray_z_example_normal_str_test.go index bb721c71d..a4daab3f2 100644 --- a/container/garray/garray_z_example_normal_str_test.go +++ b/container/garray/garray_z_example_normal_str_test.go @@ -10,10 +10,9 @@ import ( "fmt" "strings" - "github.com/gogf/gf/v2/internal/empty" - "github.com/gogf/gf/v2/container/garray" "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/internal/empty" "github.com/gogf/gf/v2/internal/json" "github.com/gogf/gf/v2/text/gstr" "github.com/gogf/gf/v2/util/gconv" diff --git a/container/garray/garray_z_example_sorted_str_test.go b/container/garray/garray_z_example_sorted_str_test.go index 466e52caa..bbd3a1aee 100644 --- a/container/garray/garray_z_example_sorted_str_test.go +++ b/container/garray/garray_z_example_sorted_str_test.go @@ -9,10 +9,9 @@ package garray_test import ( "fmt" - "github.com/gogf/gf/v2/internal/empty" - "github.com/gogf/gf/v2/container/garray" "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/internal/empty" "github.com/gogf/gf/v2/internal/json" "github.com/gogf/gf/v2/util/gconv" ) diff --git a/container/garray/garray_z_unit_normal_any_test.go b/container/garray/garray_z_unit_normal_any_test.go index be381c9d4..5cce77949 100644 --- a/container/garray/garray_z_unit_normal_any_test.go +++ b/container/garray/garray_z_unit_normal_any_test.go @@ -12,10 +12,9 @@ import ( "testing" "time" - "github.com/gogf/gf/v2/internal/empty" - "github.com/gogf/gf/v2/container/garray" "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/internal/empty" "github.com/gogf/gf/v2/internal/json" "github.com/gogf/gf/v2/test/gtest" "github.com/gogf/gf/v2/util/gconv" diff --git a/container/garray/garray_z_unit_normal_int_test.go b/container/garray/garray_z_unit_normal_int_test.go index 9d7dd814a..d3f0a3d5c 100644 --- a/container/garray/garray_z_unit_normal_int_test.go +++ b/container/garray/garray_z_unit_normal_int_test.go @@ -12,10 +12,9 @@ import ( "testing" "time" - "github.com/gogf/gf/v2/internal/empty" - "github.com/gogf/gf/v2/container/garray" "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/internal/empty" "github.com/gogf/gf/v2/internal/json" "github.com/gogf/gf/v2/test/gtest" "github.com/gogf/gf/v2/util/gconv" diff --git a/container/garray/garray_z_unit_normal_str_test.go b/container/garray/garray_z_unit_normal_str_test.go index f71ec473d..23a43c39b 100644 --- a/container/garray/garray_z_unit_normal_str_test.go +++ b/container/garray/garray_z_unit_normal_str_test.go @@ -13,10 +13,9 @@ import ( "testing" "time" - "github.com/gogf/gf/v2/internal/empty" - "github.com/gogf/gf/v2/container/garray" "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/internal/empty" "github.com/gogf/gf/v2/internal/json" "github.com/gogf/gf/v2/test/gtest" "github.com/gogf/gf/v2/util/gconv" diff --git a/container/garray/garray_z_unit_sorted_any_test.go b/container/garray/garray_z_unit_sorted_any_test.go index 3be78342e..70cf53dd3 100644 --- a/container/garray/garray_z_unit_sorted_any_test.go +++ b/container/garray/garray_z_unit_sorted_any_test.go @@ -13,10 +13,9 @@ import ( "testing" "time" - "github.com/gogf/gf/v2/internal/empty" - "github.com/gogf/gf/v2/container/garray" "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/internal/empty" "github.com/gogf/gf/v2/internal/json" "github.com/gogf/gf/v2/test/gtest" "github.com/gogf/gf/v2/util/gconv" diff --git a/container/garray/garray_z_unit_sorted_int_test.go b/container/garray/garray_z_unit_sorted_int_test.go index 65c921611..a4ebf4fe9 100644 --- a/container/garray/garray_z_unit_sorted_int_test.go +++ b/container/garray/garray_z_unit_sorted_int_test.go @@ -12,10 +12,9 @@ import ( "testing" "time" - "github.com/gogf/gf/v2/internal/empty" - "github.com/gogf/gf/v2/container/garray" "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/internal/empty" "github.com/gogf/gf/v2/internal/json" "github.com/gogf/gf/v2/test/gtest" "github.com/gogf/gf/v2/util/gconv" diff --git a/container/garray/garray_z_unit_sorted_str_test.go b/container/garray/garray_z_unit_sorted_str_test.go index 458f9043a..d1fef5c99 100644 --- a/container/garray/garray_z_unit_sorted_str_test.go +++ b/container/garray/garray_z_unit_sorted_str_test.go @@ -12,10 +12,9 @@ import ( "testing" "time" - "github.com/gogf/gf/v2/internal/empty" - "github.com/gogf/gf/v2/container/garray" "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/internal/empty" "github.com/gogf/gf/v2/internal/json" "github.com/gogf/gf/v2/test/gtest" "github.com/gogf/gf/v2/text/gstr" diff --git a/container/gmap/gmap_hash_any_any_map.go b/container/gmap/gmap_hash_any_any_map.go index 5ff0fad7a..1cf02d139 100644 --- a/container/gmap/gmap_hash_any_any_map.go +++ b/container/gmap/gmap_hash_any_any_map.go @@ -7,13 +7,14 @@ package gmap import ( + "reflect" + "github.com/gogf/gf/v2/container/gvar" "github.com/gogf/gf/v2/internal/deepcopy" "github.com/gogf/gf/v2/internal/empty" "github.com/gogf/gf/v2/internal/json" "github.com/gogf/gf/v2/internal/rwmutex" "github.com/gogf/gf/v2/util/gconv" - "reflect" ) // AnyAnyMap wraps map type `map[interface{}]interface{}` and provides more map features. diff --git a/container/gmap/gmap_hash_int_any_map.go b/container/gmap/gmap_hash_int_any_map.go index 016fb6c97..b2d43eca7 100644 --- a/container/gmap/gmap_hash_int_any_map.go +++ b/container/gmap/gmap_hash_int_any_map.go @@ -8,13 +8,14 @@ package gmap import ( + "reflect" + "github.com/gogf/gf/v2/container/gvar" "github.com/gogf/gf/v2/internal/deepcopy" "github.com/gogf/gf/v2/internal/empty" "github.com/gogf/gf/v2/internal/json" "github.com/gogf/gf/v2/internal/rwmutex" "github.com/gogf/gf/v2/util/gconv" - "reflect" ) // IntAnyMap implements map[int]interface{} with RWMutex that has switch. diff --git a/container/gtree/gtree_avltree.go b/container/gtree/gtree_avltree.go index ac8a51a86..0d21c131e 100644 --- a/container/gtree/gtree_avltree.go +++ b/container/gtree/gtree_avltree.go @@ -10,6 +10,7 @@ import ( "fmt" "github.com/emirpasic/gods/trees/avltree" + "github.com/gogf/gf/v2/container/gvar" "github.com/gogf/gf/v2/internal/rwmutex" "github.com/gogf/gf/v2/text/gstr" diff --git a/container/gtree/gtree_btree.go b/container/gtree/gtree_btree.go index 59f450533..1ae03a132 100644 --- a/container/gtree/gtree_btree.go +++ b/container/gtree/gtree_btree.go @@ -10,6 +10,7 @@ import ( "fmt" "github.com/emirpasic/gods/trees/btree" + "github.com/gogf/gf/v2/container/gvar" "github.com/gogf/gf/v2/internal/rwmutex" "github.com/gogf/gf/v2/text/gstr" diff --git a/container/gtree/gtree_redblacktree.go b/container/gtree/gtree_redblacktree.go index c5a6bddf8..a94dc585e 100644 --- a/container/gtree/gtree_redblacktree.go +++ b/container/gtree/gtree_redblacktree.go @@ -10,6 +10,7 @@ import ( "fmt" "github.com/emirpasic/gods/trees/redblacktree" + "github.com/gogf/gf/v2/container/gvar" "github.com/gogf/gf/v2/internal/json" "github.com/gogf/gf/v2/internal/rwmutex" diff --git a/contrib/config/consul/consul_test.go b/contrib/config/consul/consul_test.go index 8b14dda86..27fff6cab 100644 --- a/contrib/config/consul/consul_test.go +++ b/contrib/config/consul/consul_test.go @@ -10,15 +10,15 @@ import ( "testing" "time" - consul "github.com/gogf/gf/contrib/config/consul/v2" - - "github.com/gogf/gf/v2/os/gctx" - "github.com/gogf/gf/v2/test/gtest" - "github.com/gogf/gf/v2/util/guid" "github.com/hashicorp/consul/api" "github.com/hashicorp/go-cleanhttp" "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gctx" + "github.com/gogf/gf/v2/test/gtest" + "github.com/gogf/gf/v2/util/guid" + + consul "github.com/gogf/gf/contrib/config/consul/v2" ) func TestConsul(t *testing.T) { diff --git a/contrib/config/kubecm/kubecm_test.go b/contrib/config/kubecm/kubecm_test.go index 6b3dc173a..d0e0ff435 100644 --- a/contrib/config/kubecm/kubecm_test.go +++ b/contrib/config/kubecm/kubecm_test.go @@ -13,13 +13,14 @@ import ( kubeMetaV1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" - "github.com/gogf/gf/contrib/config/kubecm/v2" "github.com/gogf/gf/v2/encoding/gjson" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gctx" "github.com/gogf/gf/v2/os/gfile" "github.com/gogf/gf/v2/test/gtest" "github.com/gogf/gf/v2/util/guid" + + "github.com/gogf/gf/contrib/config/kubecm/v2" ) const ( diff --git a/contrib/config/nacos/nacos_test.go b/contrib/config/nacos/nacos_test.go index 30b65a3d6..4adcfdaa6 100644 --- a/contrib/config/nacos/nacos_test.go +++ b/contrib/config/nacos/nacos_test.go @@ -12,11 +12,12 @@ import ( "github.com/nacos-group/nacos-sdk-go/v2/common/constant" "github.com/nacos-group/nacos-sdk-go/v2/vo" - "github.com/gogf/gf/contrib/config/nacos/v2" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gctx" "github.com/gogf/gf/v2/test/gtest" "github.com/gogf/gf/v2/util/guid" + + "github.com/gogf/gf/contrib/config/nacos/v2" ) var ( diff --git a/contrib/drivers/clickhouse/clickhouse_z_unit_issue_test.go b/contrib/drivers/clickhouse/clickhouse_z_unit_issue_test.go index 050f77850..78fc2fa32 100644 --- a/contrib/drivers/clickhouse/clickhouse_z_unit_issue_test.go +++ b/contrib/drivers/clickhouse/clickhouse_z_unit_issue_test.go @@ -7,9 +7,10 @@ package clickhouse import ( - "github.com/shopspring/decimal" "testing" + "github.com/shopspring/decimal" + "github.com/gogf/gf/v2/container/gvar" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/test/gtest" diff --git a/contrib/drivers/dm/dm_convert.go b/contrib/drivers/dm/dm_convert.go index 3bbc81647..f17909d29 100644 --- a/contrib/drivers/dm/dm_convert.go +++ b/contrib/drivers/dm/dm_convert.go @@ -8,7 +8,6 @@ package dm import ( "context" - "time" "github.com/gogf/gf/v2/os/gtime" diff --git a/contrib/drivers/dm/dm_do_filter.go b/contrib/drivers/dm/dm_do_filter.go index 2a91e3734..8f574aef0 100644 --- a/contrib/drivers/dm/dm_do_filter.go +++ b/contrib/drivers/dm/dm_do_filter.go @@ -8,7 +8,6 @@ package dm import ( "context" - "strings" "github.com/gogf/gf/v2/database/gdb" diff --git a/contrib/drivers/dm/dm_open.go b/contrib/drivers/dm/dm_open.go index 8c51b5ff1..ebc789b79 100644 --- a/contrib/drivers/dm/dm_open.go +++ b/contrib/drivers/dm/dm_open.go @@ -9,7 +9,6 @@ package dm import ( "database/sql" "fmt" - "net/url" "strings" diff --git a/contrib/drivers/dm/dm_table_fields.go b/contrib/drivers/dm/dm_table_fields.go index f2c715870..892973d37 100644 --- a/contrib/drivers/dm/dm_table_fields.go +++ b/contrib/drivers/dm/dm_table_fields.go @@ -9,7 +9,6 @@ package dm import ( "context" "fmt" - "strings" "github.com/gogf/gf/v2/database/gdb" diff --git a/contrib/drivers/mssql/mssql_z_unit_model_test.go b/contrib/drivers/mssql/mssql_z_unit_model_test.go index 7435e84cc..e9eac7428 100644 --- a/contrib/drivers/mssql/mssql_z_unit_model_test.go +++ b/contrib/drivers/mssql/mssql_z_unit_model_test.go @@ -12,14 +12,13 @@ import ( "testing" "time" - "github.com/gogf/gf/v2/util/gconv" - "github.com/gogf/gf/v2/container/garray" "github.com/gogf/gf/v2/container/gmap" "github.com/gogf/gf/v2/database/gdb" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gtime" "github.com/gogf/gf/v2/test/gtest" + "github.com/gogf/gf/v2/util/gconv" "github.com/gogf/gf/v2/util/guid" "github.com/gogf/gf/v2/util/gutil" ) diff --git a/contrib/drivers/mysql/mysql_z_unit_feature_with_test.go b/contrib/drivers/mysql/mysql_z_unit_feature_with_test.go index f71a3d378..64a491991 100644 --- a/contrib/drivers/mysql/mysql_z_unit_feature_with_test.go +++ b/contrib/drivers/mysql/mysql_z_unit_feature_with_test.go @@ -10,10 +10,9 @@ import ( "fmt" "testing" - "github.com/gogf/gf/v2/os/gtime" - "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gfile" + "github.com/gogf/gf/v2/os/gtime" "github.com/gogf/gf/v2/test/gtest" "github.com/gogf/gf/v2/text/gstr" "github.com/gogf/gf/v2/util/gmeta" diff --git a/contrib/drivers/oracle/oracle_do_insert.go b/contrib/drivers/oracle/oracle_do_insert.go index 381597d35..cf6a9b14b 100644 --- a/contrib/drivers/oracle/oracle_do_insert.go +++ b/contrib/drivers/oracle/oracle_do_insert.go @@ -13,11 +13,10 @@ import ( "strings" "github.com/gogf/gf/v2/container/gset" - "github.com/gogf/gf/v2/text/gstr" - "github.com/gogf/gf/v2/database/gdb" "github.com/gogf/gf/v2/errors/gcode" "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/text/gstr" "github.com/gogf/gf/v2/util/gconv" ) diff --git a/contrib/drivers/oracle/oracle_z_unit_basic_test.go b/contrib/drivers/oracle/oracle_z_unit_basic_test.go index d54a13c43..83b926bfc 100644 --- a/contrib/drivers/oracle/oracle_z_unit_basic_test.go +++ b/contrib/drivers/oracle/oracle_z_unit_basic_test.go @@ -12,11 +12,10 @@ import ( "testing" "github.com/gogf/gf/v2/database/gdb" - "github.com/gogf/gf/v2/util/gconv" - "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gtime" "github.com/gogf/gf/v2/test/gtest" + "github.com/gogf/gf/v2/util/gconv" ) func Test_Tables(t *testing.T) { diff --git a/contrib/drivers/pgsql/pgsql_convert.go b/contrib/drivers/pgsql/pgsql_convert.go index 8ccd6e54f..a657bee76 100644 --- a/contrib/drivers/pgsql/pgsql_convert.go +++ b/contrib/drivers/pgsql/pgsql_convert.go @@ -8,10 +8,11 @@ package pgsql import ( "context" - "github.com/lib/pq" "reflect" "strings" + "github.com/lib/pq" + "github.com/gogf/gf/v2/database/gdb" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/text/gregex" diff --git a/contrib/drivers/pgsql/pgsql_do_filter.go b/contrib/drivers/pgsql/pgsql_do_filter.go index a595d908a..a04ed9a08 100644 --- a/contrib/drivers/pgsql/pgsql_do_filter.go +++ b/contrib/drivers/pgsql/pgsql_do_filter.go @@ -9,6 +9,7 @@ package pgsql import ( "context" "fmt" + "github.com/gogf/gf/v2/database/gdb" "github.com/gogf/gf/v2/text/gregex" "github.com/gogf/gf/v2/text/gstr" diff --git a/contrib/drivers/pgsql/pgsql_do_insert.go b/contrib/drivers/pgsql/pgsql_do_insert.go index 15a102cdc..ec24edde3 100644 --- a/contrib/drivers/pgsql/pgsql_do_insert.go +++ b/contrib/drivers/pgsql/pgsql_do_insert.go @@ -9,6 +9,7 @@ package pgsql import ( "context" "database/sql" + "github.com/gogf/gf/v2/database/gdb" "github.com/gogf/gf/v2/errors/gcode" "github.com/gogf/gf/v2/errors/gerror" diff --git a/contrib/drivers/pgsql/pgsql_z_unit_init_test.go b/contrib/drivers/pgsql/pgsql_z_unit_init_test.go index 023efdee1..e317d3000 100644 --- a/contrib/drivers/pgsql/pgsql_z_unit_init_test.go +++ b/contrib/drivers/pgsql/pgsql_z_unit_init_test.go @@ -7,11 +7,11 @@ package pgsql_test import ( - _ "github.com/gogf/gf/contrib/drivers/pgsql/v2" - "context" "fmt" + _ "github.com/gogf/gf/contrib/drivers/pgsql/v2" + "github.com/gogf/gf/v2/container/garray" "github.com/gogf/gf/v2/database/gdb" "github.com/gogf/gf/v2/frame/g" diff --git a/contrib/drivers/pgsql/pgsql_z_unit_issue_test.go b/contrib/drivers/pgsql/pgsql_z_unit_issue_test.go index b329cdfdf..47122c461 100644 --- a/contrib/drivers/pgsql/pgsql_z_unit_issue_test.go +++ b/contrib/drivers/pgsql/pgsql_z_unit_issue_test.go @@ -11,7 +11,6 @@ import ( "testing" "github.com/gogf/gf/v2/database/gdb" - "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gtime" "github.com/gogf/gf/v2/test/gtest" diff --git a/contrib/metric/otelmetric/otelmetric_z_unit_http_test.go b/contrib/metric/otelmetric/otelmetric_z_unit_http_test.go index 36a644f0d..325a9a8ab 100644 --- a/contrib/metric/otelmetric/otelmetric_z_unit_http_test.go +++ b/contrib/metric/otelmetric/otelmetric_z_unit_http_test.go @@ -14,7 +14,6 @@ import ( "github.com/prometheus/client_golang/prometheus/promhttp" "go.opentelemetry.io/otel/exporters/prometheus" - "github.com/gogf/gf/contrib/metric/otelmetric/v2" "github.com/gogf/gf/v2" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/net/ghttp" @@ -24,6 +23,8 @@ import ( "github.com/gogf/gf/v2/text/gregex" "github.com/gogf/gf/v2/text/gstr" "github.com/gogf/gf/v2/util/guid" + + "github.com/gogf/gf/contrib/metric/otelmetric/v2" ) func Test_HTTP_Server(t *testing.T) { diff --git a/contrib/metric/otelmetric/otelmetric_z_unit_test.go b/contrib/metric/otelmetric/otelmetric_z_unit_test.go index 9b6b78fe6..54c08a20e 100644 --- a/contrib/metric/otelmetric/otelmetric_z_unit_test.go +++ b/contrib/metric/otelmetric/otelmetric_z_unit_test.go @@ -13,12 +13,13 @@ import ( "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/metric/metricdata" - "github.com/gogf/gf/contrib/metric/otelmetric/v2" "github.com/gogf/gf/v2/encoding/gjson" "github.com/gogf/gf/v2/os/gctx" "github.com/gogf/gf/v2/os/gmetric" "github.com/gogf/gf/v2/test/gtest" "github.com/gogf/gf/v2/text/gstr" + + "github.com/gogf/gf/contrib/metric/otelmetric/v2" ) func Test_Basic(t *testing.T) { diff --git a/contrib/nosql/redis/redis_z_group_set_test.go b/contrib/nosql/redis/redis_z_group_set_test.go index b843ab0a8..94bf40608 100644 --- a/contrib/nosql/redis/redis_z_group_set_test.go +++ b/contrib/nosql/redis/redis_z_group_set_test.go @@ -7,9 +7,10 @@ package redis_test import ( + "testing" + "github.com/gogf/gf/v2/test/gtest" "github.com/gogf/gf/v2/util/guid" - "testing" ) func Test_GroupSet_SAdd(t *testing.T) { diff --git a/contrib/nosql/redis/redis_z_unit_config_test.go b/contrib/nosql/redis/redis_z_unit_config_test.go index b11d07d51..e14c3f710 100644 --- a/contrib/nosql/redis/redis_z_unit_config_test.go +++ b/contrib/nosql/redis/redis_z_unit_config_test.go @@ -7,10 +7,10 @@ package redis_test import ( - "github.com/gogf/gf/v2/container/gvar" "testing" "time" + "github.com/gogf/gf/v2/container/gvar" "github.com/gogf/gf/v2/database/gredis" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/test/gtest" diff --git a/contrib/nosql/redis/redis_z_unit_gcache_adapter_test.go b/contrib/nosql/redis/redis_z_unit_gcache_adapter_test.go index e780f51b4..735309638 100644 --- a/contrib/nosql/redis/redis_z_unit_gcache_adapter_test.go +++ b/contrib/nosql/redis/redis_z_unit_gcache_adapter_test.go @@ -8,11 +8,11 @@ package redis_test import ( "context" - "github.com/gogf/gf/v2/frame/g" "testing" "time" "github.com/gogf/gf/v2/database/gredis" + "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gcache" "github.com/gogf/gf/v2/test/gtest" ) diff --git a/contrib/registry/etcd/etcd_z_test.go b/contrib/registry/etcd/etcd_z_test.go index 5dc3910a7..c4a8194db 100644 --- a/contrib/registry/etcd/etcd_z_test.go +++ b/contrib/registry/etcd/etcd_z_test.go @@ -9,11 +9,12 @@ package etcd_test import ( "testing" - "github.com/gogf/gf/contrib/registry/etcd/v2" "github.com/gogf/gf/v2/net/gsvc" "github.com/gogf/gf/v2/os/gctx" "github.com/gogf/gf/v2/test/gtest" "github.com/gogf/gf/v2/util/guid" + + "github.com/gogf/gf/contrib/registry/etcd/v2" ) func TestRegistry(t *testing.T) { diff --git a/contrib/registry/file/file_z_basic_test.go b/contrib/registry/file/file_z_basic_test.go index 7fc7827fb..61bd22aa6 100644 --- a/contrib/registry/file/file_z_basic_test.go +++ b/contrib/registry/file/file_z_basic_test.go @@ -9,12 +9,13 @@ package file_test import ( "testing" - "github.com/gogf/gf/contrib/registry/file/v2" "github.com/gogf/gf/v2/net/gsvc" "github.com/gogf/gf/v2/os/gctx" "github.com/gogf/gf/v2/os/gfile" "github.com/gogf/gf/v2/test/gtest" "github.com/gogf/gf/v2/util/guid" + + "github.com/gogf/gf/contrib/registry/file/v2" ) func TestRegistry(t *testing.T) { diff --git a/contrib/registry/file/file_z_http_test.go b/contrib/registry/file/file_z_http_test.go index 5edfd53c3..a1eac283b 100644 --- a/contrib/registry/file/file_z_http_test.go +++ b/contrib/registry/file/file_z_http_test.go @@ -11,7 +11,6 @@ import ( "testing" "time" - "github.com/gogf/gf/contrib/registry/file/v2" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/net/ghttp" "github.com/gogf/gf/v2/net/gsvc" @@ -20,6 +19,8 @@ import ( "github.com/gogf/gf/v2/test/gtest" "github.com/gogf/gf/v2/text/gstr" "github.com/gogf/gf/v2/util/guid" + + "github.com/gogf/gf/contrib/registry/file/v2" ) var ctx = gctx.GetInitCtx() diff --git a/contrib/registry/nacos/nacos.go b/contrib/registry/nacos/nacos.go index 600ebe635..799db2a5d 100644 --- a/contrib/registry/nacos/nacos.go +++ b/contrib/registry/nacos/nacos.go @@ -10,6 +10,11 @@ package nacos import ( "context" + "github.com/nacos-group/nacos-sdk-go/v2/clients" + "github.com/nacos-group/nacos-sdk-go/v2/clients/naming_client" + "github.com/nacos-group/nacos-sdk-go/v2/common/constant" + "github.com/nacos-group/nacos-sdk-go/v2/vo" + "github.com/gogf/gf/v2/errors/gcode" "github.com/gogf/gf/v2/errors/gerror" "github.com/gogf/gf/v2/frame/g" @@ -17,10 +22,6 @@ import ( "github.com/gogf/gf/v2/os/gctx" "github.com/gogf/gf/v2/text/gstr" "github.com/gogf/gf/v2/util/gconv" - "github.com/nacos-group/nacos-sdk-go/v2/clients" - "github.com/nacos-group/nacos-sdk-go/v2/clients/naming_client" - "github.com/nacos-group/nacos-sdk-go/v2/common/constant" - "github.com/nacos-group/nacos-sdk-go/v2/vo" ) const ( diff --git a/contrib/registry/nacos/nacos_discovery.go b/contrib/registry/nacos/nacos_discovery.go index 6e38585db..d9d1eecd9 100644 --- a/contrib/registry/nacos/nacos_discovery.go +++ b/contrib/registry/nacos/nacos_discovery.go @@ -9,12 +9,13 @@ package nacos import ( "context" + "github.com/nacos-group/nacos-sdk-go/v2/model" + "github.com/nacos-group/nacos-sdk-go/v2/vo" + "github.com/gogf/gf/v2/errors/gcode" "github.com/gogf/gf/v2/errors/gerror" "github.com/gogf/gf/v2/net/gsvc" "github.com/gogf/gf/v2/text/gstr" - "github.com/nacos-group/nacos-sdk-go/v2/model" - "github.com/nacos-group/nacos-sdk-go/v2/vo" ) // Search searches and returns services with specified condition. diff --git a/contrib/registry/nacos/nacos_register.go b/contrib/registry/nacos/nacos_register.go index afc950c60..0b94c97ce 100644 --- a/contrib/registry/nacos/nacos_register.go +++ b/contrib/registry/nacos/nacos_register.go @@ -9,9 +9,10 @@ package nacos import ( "context" + "github.com/nacos-group/nacos-sdk-go/v2/vo" + "github.com/gogf/gf/v2/net/gsvc" "github.com/gogf/gf/v2/util/gconv" - "github.com/nacos-group/nacos-sdk-go/v2/vo" ) // Register registers `service` to Registry. diff --git a/contrib/registry/nacos/nacos_service.go b/contrib/registry/nacos/nacos_service.go index 8ac5f5ce1..ee2208c75 100644 --- a/contrib/registry/nacos/nacos_service.go +++ b/contrib/registry/nacos/nacos_service.go @@ -9,10 +9,11 @@ package nacos import ( "fmt" + "github.com/nacos-group/nacos-sdk-go/v2/model" + "github.com/gogf/gf/v2/container/gmap" "github.com/gogf/gf/v2/net/gsvc" "github.com/gogf/gf/v2/text/gstr" - "github.com/nacos-group/nacos-sdk-go/v2/model" ) // NewServiceFromInstance new one service from instance diff --git a/contrib/registry/nacos/nacos_watcher.go b/contrib/registry/nacos/nacos_watcher.go index c9454d164..fe34441f7 100644 --- a/contrib/registry/nacos/nacos_watcher.go +++ b/contrib/registry/nacos/nacos_watcher.go @@ -9,10 +9,11 @@ package nacos import ( "context" + "github.com/nacos-group/nacos-sdk-go/v2/model" + "github.com/gogf/gf/v2/errors/gcode" "github.com/gogf/gf/v2/errors/gerror" "github.com/gogf/gf/v2/net/gsvc" - "github.com/nacos-group/nacos-sdk-go/v2/model" ) // Watcher used to mange service event such as update. diff --git a/contrib/registry/nacos/nacos_z_test.go b/contrib/registry/nacos/nacos_z_test.go index 0470c4abb..f61038492 100644 --- a/contrib/registry/nacos/nacos_z_test.go +++ b/contrib/registry/nacos/nacos_z_test.go @@ -12,13 +12,15 @@ import ( "testing" "time" - "github.com/gogf/gf/contrib/registry/nacos/v2" + "github.com/nacos-group/nacos-sdk-go/v2/common/constant" + "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/net/gsvc" "github.com/gogf/gf/v2/os/gctx" "github.com/gogf/gf/v2/test/gtest" "github.com/gogf/gf/v2/util/guid" - "github.com/nacos-group/nacos-sdk-go/v2/common/constant" + + "github.com/gogf/gf/contrib/registry/nacos/v2" ) const ( diff --git a/contrib/registry/zookeeper/zookeeper.go b/contrib/registry/zookeeper/zookeeper.go index b32791855..be4b59c8c 100644 --- a/contrib/registry/zookeeper/zookeeper.go +++ b/contrib/registry/zookeeper/zookeeper.go @@ -8,9 +8,10 @@ package zookeeper import ( + "time" + "github.com/go-zookeeper/zk" "golang.org/x/sync/singleflight" - "time" "github.com/gogf/gf/v2/errors/gerror" "github.com/gogf/gf/v2/net/gsvc" diff --git a/contrib/registry/zookeeper/zookeeper_registrar.go b/contrib/registry/zookeeper/zookeeper_registrar.go index 26273a5b2..5a67ff0b1 100644 --- a/contrib/registry/zookeeper/zookeeper_registrar.go +++ b/contrib/registry/zookeeper/zookeeper_registrar.go @@ -8,12 +8,13 @@ package zookeeper import ( "context" - "github.com/go-zookeeper/zk" - "github.com/gogf/gf/v2/errors/gerror" "path" "strings" "time" + "github.com/go-zookeeper/zk" + + "github.com/gogf/gf/v2/errors/gerror" "github.com/gogf/gf/v2/net/gsvc" ) diff --git a/contrib/registry/zookeeper/zookeeper_watcher.go b/contrib/registry/zookeeper/zookeeper_watcher.go index 1ee710a17..5efea6f57 100644 --- a/contrib/registry/zookeeper/zookeeper_watcher.go +++ b/contrib/registry/zookeeper/zookeeper_watcher.go @@ -9,11 +9,12 @@ package zookeeper import ( "context" "errors" - "github.com/go-zookeeper/zk" - "golang.org/x/sync/singleflight" "path" "strings" + "github.com/go-zookeeper/zk" + "golang.org/x/sync/singleflight" + "github.com/gogf/gf/v2/errors/gerror" "github.com/gogf/gf/v2/net/gsvc" ) diff --git a/contrib/rpc/grpcx/grpcx_interceptor_client.go b/contrib/rpc/grpcx/grpcx_interceptor_client.go index d14182349..bc185d7d1 100644 --- a/contrib/rpc/grpcx/grpcx_interceptor_client.go +++ b/contrib/rpc/grpcx/grpcx_interceptor_client.go @@ -12,9 +12,10 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/status" - "github.com/gogf/gf/contrib/rpc/grpcx/v2/internal/tracing" "github.com/gogf/gf/v2/errors/gcode" "github.com/gogf/gf/v2/errors/gerror" + + "github.com/gogf/gf/contrib/rpc/grpcx/v2/internal/tracing" ) // UnaryError handles the error types converting between grpc and gerror. diff --git a/contrib/rpc/grpcx/grpcx_interceptor_server.go b/contrib/rpc/grpcx/grpcx_interceptor_server.go index 29b922b29..0d968f6a8 100644 --- a/contrib/rpc/grpcx/grpcx_interceptor_server.go +++ b/contrib/rpc/grpcx/grpcx_interceptor_server.go @@ -8,17 +8,18 @@ package grpcx import ( "context" - "google.golang.org/protobuf/proto" "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" - "github.com/gogf/gf/contrib/rpc/grpcx/v2/internal/tracing" "github.com/gogf/gf/v2/errors/gcode" "github.com/gogf/gf/v2/errors/gerror" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/util/gutil" + + "github.com/gogf/gf/contrib/rpc/grpcx/v2/internal/tracing" ) // ChainUnary returns a ServerOption that specifies the chained interceptor diff --git a/contrib/rpc/grpcx/grpcx_registry_file.go b/contrib/rpc/grpcx/grpcx_registry_file.go index 4605b94e8..5e2fef9a7 100644 --- a/contrib/rpc/grpcx/grpcx_registry_file.go +++ b/contrib/rpc/grpcx/grpcx_registry_file.go @@ -7,12 +7,12 @@ package grpcx import ( - "github.com/gogf/gf/contrib/registry/file/v2" - "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/net/gsvc" "github.com/gogf/gf/v2/os/gctx" "github.com/gogf/gf/v2/os/gfile" + + "github.com/gogf/gf/contrib/registry/file/v2" ) // autoLoadAndRegisterFileRegistry checks and registers ETCD service as default service registry diff --git a/contrib/rpc/grpcx/grpcx_unit_z_ctx_test.go b/contrib/rpc/grpcx/grpcx_unit_z_ctx_test.go index cacf4e294..c673d13be 100644 --- a/contrib/rpc/grpcx/grpcx_unit_z_ctx_test.go +++ b/contrib/rpc/grpcx/grpcx_unit_z_ctx_test.go @@ -12,9 +12,10 @@ import ( "google.golang.org/grpc/metadata" - "github.com/gogf/gf/contrib/rpc/grpcx/v2" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/test/gtest" + + "github.com/gogf/gf/contrib/rpc/grpcx/v2" ) func Test_Ctx_Basic(t *testing.T) { diff --git a/contrib/rpc/grpcx/grpcx_unit_z_grpc_server_basic_test.go b/contrib/rpc/grpcx/grpcx_unit_z_grpc_server_basic_test.go index f3ffb137b..12cec2a3b 100644 --- a/contrib/rpc/grpcx/grpcx_unit_z_grpc_server_basic_test.go +++ b/contrib/rpc/grpcx/grpcx_unit_z_grpc_server_basic_test.go @@ -11,14 +11,15 @@ import ( "testing" "time" - "github.com/gogf/gf/contrib/rpc/grpcx/v2" - "github.com/gogf/gf/contrib/rpc/grpcx/v2/testdata/controller" - "github.com/gogf/gf/contrib/rpc/grpcx/v2/testdata/protobuf" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/net/gipv4" "github.com/gogf/gf/v2/os/gctx" "github.com/gogf/gf/v2/test/gtest" "github.com/gogf/gf/v2/util/guid" + + "github.com/gogf/gf/contrib/rpc/grpcx/v2" + "github.com/gogf/gf/contrib/rpc/grpcx/v2/testdata/controller" + "github.com/gogf/gf/contrib/rpc/grpcx/v2/testdata/protobuf" ) func Test_Grpcx_Grpc_Server_Basic(t *testing.T) { diff --git a/contrib/rpc/grpcx/grpcx_unit_z_issue_test.go b/contrib/rpc/grpcx/grpcx_unit_z_issue_test.go index 980ab54d7..531d0b284 100644 --- a/contrib/rpc/grpcx/grpcx_unit_z_issue_test.go +++ b/contrib/rpc/grpcx/grpcx_unit_z_issue_test.go @@ -9,16 +9,18 @@ package grpcx_test import ( "context" "fmt" - "google.golang.org/grpc" - "google.golang.org/grpc/credentials/insecure" "testing" "time" - "github.com/gogf/gf/contrib/rpc/grpcx/v2" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" + "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/net/ghttp" "github.com/gogf/gf/v2/test/gtest" "github.com/gogf/gf/v2/util/guid" + + "github.com/gogf/gf/contrib/rpc/grpcx/v2" ) var ctx = context.Background() diff --git a/contrib/rpc/grpcx/internal/balancer/balancer_builder.go b/contrib/rpc/grpcx/internal/balancer/balancer_builder.go index 6e2de3210..83cb5f5aa 100644 --- a/contrib/rpc/grpcx/internal/balancer/balancer_builder.go +++ b/contrib/rpc/grpcx/internal/balancer/balancer_builder.go @@ -8,6 +8,7 @@ package balancer import ( "context" + "google.golang.org/grpc/balancer" "google.golang.org/grpc/balancer/base" diff --git a/contrib/rpc/grpcx/internal/tracing/tracing_interceptor_client.go b/contrib/rpc/grpcx/internal/tracing/tracing_interceptor_client.go index a244eeb0d..b688446f7 100644 --- a/contrib/rpc/grpcx/internal/tracing/tracing_interceptor_client.go +++ b/contrib/rpc/grpcx/internal/tracing/tracing_interceptor_client.go @@ -18,10 +18,11 @@ import ( "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" - "github.com/gogf/gf/contrib/rpc/grpcx/v2/internal/grpcctx" "github.com/gogf/gf/v2" "github.com/gogf/gf/v2/net/gtrace" "github.com/gogf/gf/v2/util/gconv" + + "github.com/gogf/gf/contrib/rpc/grpcx/v2/internal/grpcctx" ) // UnaryClientInterceptor returns a grpc.UnaryClientInterceptor suitable diff --git a/contrib/rpc/grpcx/internal/tracing/tracing_interceptor_server.go b/contrib/rpc/grpcx/internal/tracing/tracing_interceptor_server.go index fe77c6020..7395d5cf0 100644 --- a/contrib/rpc/grpcx/internal/tracing/tracing_interceptor_server.go +++ b/contrib/rpc/grpcx/internal/tracing/tracing_interceptor_server.go @@ -19,10 +19,11 @@ import ( "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" - "github.com/gogf/gf/contrib/rpc/grpcx/v2/internal/grpcctx" "github.com/gogf/gf/v2" "github.com/gogf/gf/v2/net/gtrace" "github.com/gogf/gf/v2/util/gconv" + + "github.com/gogf/gf/contrib/rpc/grpcx/v2/internal/grpcctx" ) // UnaryServerInterceptor returns a grpc.UnaryServerInterceptor suitable diff --git a/contrib/sdk/httpclient/httpclient_z_unit_feature_handler_test.go b/contrib/sdk/httpclient/httpclient_z_unit_feature_handler_test.go index 6561f9e79..2babecd88 100644 --- a/contrib/sdk/httpclient/httpclient_z_unit_feature_handler_test.go +++ b/contrib/sdk/httpclient/httpclient_z_unit_feature_handler_test.go @@ -12,7 +12,6 @@ import ( "testing" "time" - "github.com/gogf/gf/contrib/sdk/httpclient/v2" "github.com/gogf/gf/v2/errors/gcode" "github.com/gogf/gf/v2/errors/gerror" "github.com/gogf/gf/v2/frame/g" @@ -21,6 +20,8 @@ import ( "github.com/gogf/gf/v2/os/gctx" "github.com/gogf/gf/v2/test/gtest" "github.com/gogf/gf/v2/util/guid" + + "github.com/gogf/gf/contrib/sdk/httpclient/v2" ) func Test_HttpClient_With_Default_Handler(t *testing.T) { diff --git a/database/gdb/gdb_core_underlying.go b/database/gdb/gdb_core_underlying.go index 166f5785b..d8c1171ca 100644 --- a/database/gdb/gdb_core_underlying.go +++ b/database/gdb/gdb_core_underlying.go @@ -16,14 +16,13 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/trace" - "github.com/gogf/gf/v2/util/gconv" - "github.com/gogf/gf/v2" "github.com/gogf/gf/v2/container/gvar" "github.com/gogf/gf/v2/errors/gcode" "github.com/gogf/gf/v2/errors/gerror" "github.com/gogf/gf/v2/internal/intlog" "github.com/gogf/gf/v2/os/gtime" + "github.com/gogf/gf/v2/util/gconv" "github.com/gogf/gf/v2/util/guid" ) diff --git a/debug/gdebug/gdebug_grid.go b/debug/gdebug/gdebug_grid.go index f43023d87..4d1aa8faa 100644 --- a/debug/gdebug/gdebug_grid.go +++ b/debug/gdebug/gdebug_grid.go @@ -12,10 +12,8 @@ import ( "strconv" ) -var ( - // gridRegex is the regular expression object for parsing goroutine id from stack information. - gridRegex = regexp.MustCompile(`^\w+\s+(\d+)\s+`) -) +// gridRegex is the regular expression object for parsing goroutine id from stack information. +var gridRegex = regexp.MustCompile(`^\w+\s+(\d+)\s+`) // GoroutineId retrieves and returns the current goroutine id from stack information. // Be very aware that, it is with low performance as it uses runtime.Stack function. diff --git a/encoding/gcharset/gcharset.go b/encoding/gcharset/gcharset.go index 35c2e7366..5bb6a5ac0 100644 --- a/encoding/gcharset/gcharset.go +++ b/encoding/gcharset/gcharset.go @@ -33,15 +33,13 @@ import ( "github.com/gogf/gf/v2/internal/intlog" ) -var ( - // Alias for charsets. - charsetAlias = map[string]string{ - "HZGB2312": "HZ-GB-2312", - "hzgb2312": "HZ-GB-2312", - "GB2312": "HZ-GB-2312", - "gb2312": "HZ-GB-2312", - } -) +// Alias for charsets. +var charsetAlias = map[string]string{ + "HZGB2312": "HZ-GB-2312", + "hzgb2312": "HZ-GB-2312", + "GB2312": "HZ-GB-2312", + "gb2312": "HZ-GB-2312", +} // Supported returns whether charset `charset` is supported. func Supported(charset string) bool { diff --git a/encoding/ghtml/ghtml.go b/encoding/ghtml/ghtml.go index 34fa027aa..d027fb192 100644 --- a/encoding/ghtml/ghtml.go +++ b/encoding/ghtml/ghtml.go @@ -12,9 +12,10 @@ import ( "reflect" "strings" + strip "github.com/grokify/html-strip-tags-go" + "github.com/gogf/gf/v2/errors/gcode" "github.com/gogf/gf/v2/errors/gerror" - strip "github.com/grokify/html-strip-tags-go" ) // StripTags strips HTML tags from content, and returns only text. diff --git a/encoding/gurl/url.go b/encoding/gurl/url.go index b4ee072c8..e519f3481 100644 --- a/encoding/gurl/url.go +++ b/encoding/gurl/url.go @@ -61,7 +61,7 @@ func ParseURL(str string, component int) (map[string]string, error) { if component == -1 { component = 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128 } - var components = make(map[string]string) + components := make(map[string]string) if (component & 1) == 1 { components["scheme"] = u.Scheme } diff --git a/errors/gerror/gerror_error.go b/errors/gerror/gerror_error.go index 4824f9bb2..18a181184 100644 --- a/errors/gerror/gerror_error.go +++ b/errors/gerror/gerror_error.go @@ -28,10 +28,8 @@ const ( stackFilterKeyLocal = "/errors/gerror/gerror" ) -var ( - // goRootForFilter is used for stack filtering in development environment purpose. - goRootForFilter = runtime.GOROOT() -) +// goRootForFilter is used for stack filtering in development environment purpose. +var goRootForFilter = runtime.GOROOT() func init() { if goRootForFilter != "" { diff --git a/errors/gerror/gerror_error_stack.go b/errors/gerror/gerror_error_stack.go index 741daaa29..553abd5a8 100644 --- a/errors/gerror/gerror_error_stack.go +++ b/errors/gerror/gerror_error_stack.go @@ -101,7 +101,7 @@ func filterLinesOfStackInfos(infos []*stackInfo) { // formatStackInfos formats and returns error stack information as string. func formatStackInfos(infos []*stackInfo) string { - var buffer = bytes.NewBuffer(nil) + buffer := bytes.NewBuffer(nil) for i, info := range infos { buffer.WriteString(fmt.Sprintf("%d. %s\n", i+1, info.Message)) if info.Lines != nil && info.Lines.Len() > 0 { diff --git a/example/balancer/http/client/client.go b/example/balancer/http/client/client.go index 895a3bc57..38f9ea0e1 100644 --- a/example/balancer/http/client/client.go +++ b/example/balancer/http/client/client.go @@ -7,11 +7,12 @@ package main import ( - "github.com/gogf/gf/contrib/registry/etcd/v2" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/net/gsel" "github.com/gogf/gf/v2/net/gsvc" "github.com/gogf/gf/v2/os/gctx" + + "github.com/gogf/gf/contrib/registry/etcd/v2" ) func main() { diff --git a/example/balancer/http/server/server.go b/example/balancer/http/server/server.go index 3e5772441..fa157d36e 100644 --- a/example/balancer/http/server/server.go +++ b/example/balancer/http/server/server.go @@ -7,10 +7,11 @@ package main import ( - "github.com/gogf/gf/contrib/registry/etcd/v2" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/net/ghttp" "github.com/gogf/gf/v2/net/gsvc" + + "github.com/gogf/gf/contrib/registry/etcd/v2" ) func main() { diff --git a/example/balancer/polaris/client/client.go b/example/balancer/polaris/client/client.go index 34a0c7ecd..d40fd3c71 100644 --- a/example/balancer/polaris/client/client.go +++ b/example/balancer/polaris/client/client.go @@ -15,11 +15,12 @@ import ( "github.com/polarismesh/polaris-go/api" "github.com/polarismesh/polaris-go/pkg/config" - "github.com/gogf/gf/contrib/registry/polaris/v2" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/net/gsel" "github.com/gogf/gf/v2/net/gsvc" "github.com/gogf/gf/v2/os/gctx" + + "github.com/gogf/gf/contrib/registry/polaris/v2" ) func main() { diff --git a/example/balancer/polaris/server/server.go b/example/balancer/polaris/server/server.go index 0de9af463..6be2619ab 100644 --- a/example/balancer/polaris/server/server.go +++ b/example/balancer/polaris/server/server.go @@ -13,10 +13,11 @@ import ( "github.com/polarismesh/polaris-go/api" "github.com/polarismesh/polaris-go/pkg/config" - "github.com/gogf/gf/contrib/registry/polaris/v2" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/net/ghttp" "github.com/gogf/gf/v2/net/gsvc" + + "github.com/gogf/gf/contrib/registry/polaris/v2" ) func main() { diff --git a/example/config/apollo/boot/boot.go b/example/config/apollo/boot/boot.go index a7584e913..73428dce3 100644 --- a/example/config/apollo/boot/boot.go +++ b/example/config/apollo/boot/boot.go @@ -7,9 +7,10 @@ package boot import ( - "github.com/gogf/gf/contrib/config/apollo/v2" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gctx" + + "github.com/gogf/gf/contrib/config/apollo/v2" ) func init() { diff --git a/example/config/consul/boot/boot.go b/example/config/consul/boot/boot.go index 7b090a8bd..996173bac 100644 --- a/example/config/consul/boot/boot.go +++ b/example/config/consul/boot/boot.go @@ -7,13 +7,13 @@ package boot import ( - consul "github.com/gogf/gf/contrib/config/consul/v2" - "github.com/hashicorp/consul/api" "github.com/hashicorp/go-cleanhttp" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gctx" + + consul "github.com/gogf/gf/contrib/config/consul/v2" ) func init() { diff --git a/example/config/kubecm/boot_in_pod/boot.go b/example/config/kubecm/boot_in_pod/boot.go index da0c2e3d6..083645442 100644 --- a/example/config/kubecm/boot_in_pod/boot.go +++ b/example/config/kubecm/boot_in_pod/boot.go @@ -7,9 +7,10 @@ package boot import ( - "github.com/gogf/gf/contrib/config/kubecm/v2" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gctx" + + "github.com/gogf/gf/contrib/config/kubecm/v2" ) const ( diff --git a/example/config/kubecm/boot_out_pod/boot.go b/example/config/kubecm/boot_out_pod/boot.go index 468bdc270..1be0210f5 100644 --- a/example/config/kubecm/boot_out_pod/boot.go +++ b/example/config/kubecm/boot_out_pod/boot.go @@ -9,9 +9,10 @@ package boot import ( "k8s.io/client-go/kubernetes" - "github.com/gogf/gf/contrib/config/kubecm/v2" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gctx" + + "github.com/gogf/gf/contrib/config/kubecm/v2" ) const ( diff --git a/example/config/nacos/boot/boot.go b/example/config/nacos/boot/boot.go index 6e657565a..f6e764540 100644 --- a/example/config/nacos/boot/boot.go +++ b/example/config/nacos/boot/boot.go @@ -10,9 +10,10 @@ import ( "github.com/nacos-group/nacos-sdk-go/v2/common/constant" "github.com/nacos-group/nacos-sdk-go/v2/vo" - "github.com/gogf/gf/contrib/config/nacos/v2" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gctx" + + "github.com/gogf/gf/contrib/config/nacos/v2" ) func init() { diff --git a/example/config/polaris/boot/boot.go b/example/config/polaris/boot/boot.go index 09e5e45fd..405d902fd 100644 --- a/example/config/polaris/boot/boot.go +++ b/example/config/polaris/boot/boot.go @@ -7,9 +7,10 @@ package boot import ( - "github.com/gogf/gf/contrib/config/polaris/v2" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gctx" + + "github.com/gogf/gf/contrib/config/polaris/v2" ) func init() { diff --git a/example/database/mysql/driver-encrypt-decrypt-password/main.go b/example/database/mysql/driver-encrypt-decrypt-password/main.go index 421372d5f..419eb6397 100644 --- a/example/database/mysql/driver-encrypt-decrypt-password/main.go +++ b/example/database/mysql/driver-encrypt-decrypt-password/main.go @@ -12,10 +12,11 @@ import ( "database/sql" "fmt" - "github.com/gogf/gf/contrib/drivers/mysql/v2" "github.com/gogf/gf/v2/database/gdb" "github.com/gogf/gf/v2/encoding/gbase64" "github.com/gogf/gf/v2/frame/g" + + "github.com/gogf/gf/contrib/drivers/mysql/v2" ) const ( diff --git a/example/metric/basic/main.go b/example/metric/basic/main.go index d31c696dd..dd77a6aa8 100644 --- a/example/metric/basic/main.go +++ b/example/metric/basic/main.go @@ -11,10 +11,11 @@ import ( "go.opentelemetry.io/otel/exporters/prometheus" - "github.com/gogf/gf/contrib/metric/otelmetric/v2" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gctx" "github.com/gogf/gf/v2/os/gmetric" + + "github.com/gogf/gf/contrib/metric/otelmetric/v2" ) var ( diff --git a/example/metric/callback/main.go b/example/metric/callback/main.go index 3cc402100..f64931f04 100644 --- a/example/metric/callback/main.go +++ b/example/metric/callback/main.go @@ -11,10 +11,11 @@ import ( "go.opentelemetry.io/otel/exporters/prometheus" - "github.com/gogf/gf/contrib/metric/otelmetric/v2" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gctx" "github.com/gogf/gf/v2/os/gmetric" + + "github.com/gogf/gf/contrib/metric/otelmetric/v2" ) var ( diff --git a/example/metric/dynamic_attributes/main.go b/example/metric/dynamic_attributes/main.go index 291cf3969..6c0661e38 100644 --- a/example/metric/dynamic_attributes/main.go +++ b/example/metric/dynamic_attributes/main.go @@ -11,10 +11,11 @@ import ( "go.opentelemetry.io/otel/exporters/prometheus" - "github.com/gogf/gf/contrib/metric/otelmetric/v2" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gctx" "github.com/gogf/gf/v2/os/gmetric" + + "github.com/gogf/gf/contrib/metric/otelmetric/v2" ) var ( diff --git a/example/metric/global_attributes/main.go b/example/metric/global_attributes/main.go index 53149d7b1..f57de3396 100644 --- a/example/metric/global_attributes/main.go +++ b/example/metric/global_attributes/main.go @@ -11,10 +11,11 @@ import ( "go.opentelemetry.io/otel/exporters/prometheus" - "github.com/gogf/gf/contrib/metric/otelmetric/v2" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gctx" "github.com/gogf/gf/v2/os/gmetric" + + "github.com/gogf/gf/contrib/metric/otelmetric/v2" ) const ( diff --git a/example/metric/http_client/main.go b/example/metric/http_client/main.go index 088309204..4c61c640e 100644 --- a/example/metric/http_client/main.go +++ b/example/metric/http_client/main.go @@ -9,9 +9,10 @@ package main import ( "go.opentelemetry.io/otel/exporters/prometheus" - "github.com/gogf/gf/contrib/metric/otelmetric/v2" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gctx" + + "github.com/gogf/gf/contrib/metric/otelmetric/v2" ) func main() { diff --git a/example/metric/http_server/main.go b/example/metric/http_server/main.go index be8693292..be3879506 100644 --- a/example/metric/http_server/main.go +++ b/example/metric/http_server/main.go @@ -11,10 +11,11 @@ import ( "go.opentelemetry.io/otel/exporters/prometheus" - "github.com/gogf/gf/contrib/metric/otelmetric/v2" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/net/ghttp" "github.com/gogf/gf/v2/os/gctx" + + "github.com/gogf/gf/contrib/metric/otelmetric/v2" ) func main() { diff --git a/example/metric/meter_attributes/main.go b/example/metric/meter_attributes/main.go index 1ef26cd8a..ad029d1f8 100644 --- a/example/metric/meter_attributes/main.go +++ b/example/metric/meter_attributes/main.go @@ -11,10 +11,11 @@ import ( "go.opentelemetry.io/otel/exporters/prometheus" - "github.com/gogf/gf/contrib/metric/otelmetric/v2" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gctx" "github.com/gogf/gf/v2/os/gmetric" + + "github.com/gogf/gf/contrib/metric/otelmetric/v2" ) const ( diff --git a/example/nosql/redis/adapter/main.go b/example/nosql/redis/adapter/main.go index 96b7cc827..490317efc 100644 --- a/example/nosql/redis/adapter/main.go +++ b/example/nosql/redis/adapter/main.go @@ -4,12 +4,12 @@ import ( "context" "fmt" - "github.com/gogf/gf/contrib/nosql/redis/v2" - "github.com/gogf/gf/v2/container/gvar" "github.com/gogf/gf/v2/database/gredis" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gctx" + + "github.com/gogf/gf/contrib/nosql/redis/v2" ) var ( diff --git a/example/registry/etcd/grpc/client/client.go b/example/registry/etcd/grpc/client/client.go index 17293ac61..0ff7266c0 100644 --- a/example/registry/etcd/grpc/client/client.go +++ b/example/registry/etcd/grpc/client/client.go @@ -7,11 +7,13 @@ package main import ( - "github.com/gogf/gf/contrib/registry/etcd/v2" - "github.com/gogf/gf/contrib/rpc/grpcx/v2" - "github.com/gogf/gf/example/registry/etcd/grpc/protobuf" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gctx" + + "github.com/gogf/gf/contrib/registry/etcd/v2" + "github.com/gogf/gf/contrib/rpc/grpcx/v2" + + "github.com/gogf/gf/example/registry/etcd/grpc/protobuf" ) func main() { diff --git a/example/registry/etcd/grpc/controller/helloworld.go b/example/registry/etcd/grpc/controller/helloworld.go index 86aa46c9a..c112a004e 100644 --- a/example/registry/etcd/grpc/controller/helloworld.go +++ b/example/registry/etcd/grpc/controller/helloworld.go @@ -10,6 +10,7 @@ import ( "context" "github.com/gogf/gf/contrib/rpc/grpcx/v2" + "github.com/gogf/gf/example/registry/etcd/grpc/protobuf" ) diff --git a/example/registry/etcd/grpc/server/server.go b/example/registry/etcd/grpc/server/server.go index 6fdb2124b..d3a893dff 100644 --- a/example/registry/etcd/grpc/server/server.go +++ b/example/registry/etcd/grpc/server/server.go @@ -9,6 +9,7 @@ package main import ( "github.com/gogf/gf/contrib/registry/etcd/v2" "github.com/gogf/gf/contrib/rpc/grpcx/v2" + "github.com/gogf/gf/example/registry/etcd/grpc/controller" ) diff --git a/example/registry/etcd/http/client/client.go b/example/registry/etcd/http/client/client.go index cc9f2cb80..b0f260fc8 100644 --- a/example/registry/etcd/http/client/client.go +++ b/example/registry/etcd/http/client/client.go @@ -7,10 +7,11 @@ package main import ( - "github.com/gogf/gf/contrib/registry/etcd/v2" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/net/gsvc" "github.com/gogf/gf/v2/os/gctx" + + "github.com/gogf/gf/contrib/registry/etcd/v2" ) func main() { diff --git a/example/registry/etcd/http/server/server.go b/example/registry/etcd/http/server/server.go index 3e5772441..fa157d36e 100644 --- a/example/registry/etcd/http/server/server.go +++ b/example/registry/etcd/http/server/server.go @@ -7,10 +7,11 @@ package main import ( - "github.com/gogf/gf/contrib/registry/etcd/v2" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/net/ghttp" "github.com/gogf/gf/v2/net/gsvc" + + "github.com/gogf/gf/contrib/registry/etcd/v2" ) func main() { diff --git a/example/registry/file/client/client.go b/example/registry/file/client/client.go index ca63e2ad3..d63575939 100644 --- a/example/registry/file/client/client.go +++ b/example/registry/file/client/client.go @@ -9,11 +9,12 @@ package main import ( "time" - "github.com/gogf/gf/contrib/registry/file/v2" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/net/gsvc" "github.com/gogf/gf/v2/os/gctx" "github.com/gogf/gf/v2/os/gfile" + + "github.com/gogf/gf/contrib/registry/file/v2" ) func main() { diff --git a/example/registry/file/server/server.go b/example/registry/file/server/server.go index ef68159bd..6da9a3740 100644 --- a/example/registry/file/server/server.go +++ b/example/registry/file/server/server.go @@ -7,11 +7,12 @@ package main import ( - "github.com/gogf/gf/contrib/registry/file/v2" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/net/ghttp" "github.com/gogf/gf/v2/net/gsvc" "github.com/gogf/gf/v2/os/gfile" + + "github.com/gogf/gf/contrib/registry/file/v2" ) func main() { diff --git a/example/registry/nacos/grpc/client/client.go b/example/registry/nacos/grpc/client/client.go index d9f86ffa6..f41329e96 100644 --- a/example/registry/nacos/grpc/client/client.go +++ b/example/registry/nacos/grpc/client/client.go @@ -7,11 +7,13 @@ package main import ( - "github.com/gogf/gf/contrib/registry/nacos/v2" - "github.com/gogf/gf/contrib/rpc/grpcx/v2" - "github.com/gogf/gf/example/registry/etcd/grpc/protobuf" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gctx" + + "github.com/gogf/gf/contrib/registry/nacos/v2" + "github.com/gogf/gf/contrib/rpc/grpcx/v2" + + "github.com/gogf/gf/example/registry/etcd/grpc/protobuf" ) func main() { diff --git a/example/registry/nacos/grpc/controller/helloworld.go b/example/registry/nacos/grpc/controller/helloworld.go index 86aa46c9a..c112a004e 100644 --- a/example/registry/nacos/grpc/controller/helloworld.go +++ b/example/registry/nacos/grpc/controller/helloworld.go @@ -10,6 +10,7 @@ import ( "context" "github.com/gogf/gf/contrib/rpc/grpcx/v2" + "github.com/gogf/gf/example/registry/etcd/grpc/protobuf" ) diff --git a/example/registry/nacos/grpc/server/server.go b/example/registry/nacos/grpc/server/server.go index aa2940e2d..cab827b28 100644 --- a/example/registry/nacos/grpc/server/server.go +++ b/example/registry/nacos/grpc/server/server.go @@ -9,6 +9,7 @@ package main import ( "github.com/gogf/gf/contrib/registry/nacos/v2" "github.com/gogf/gf/contrib/rpc/grpcx/v2" + "github.com/gogf/gf/example/registry/etcd/grpc/controller" ) diff --git a/example/registry/nacos/http/client/client.go b/example/registry/nacos/http/client/client.go index 96e4ed4aa..f2bf8635c 100644 --- a/example/registry/nacos/http/client/client.go +++ b/example/registry/nacos/http/client/client.go @@ -7,10 +7,11 @@ package main import ( - "github.com/gogf/gf/contrib/registry/nacos/v2" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/net/gsvc" "github.com/gogf/gf/v2/os/gctx" + + "github.com/gogf/gf/contrib/registry/nacos/v2" ) func main() { diff --git a/example/registry/nacos/http/server/server.go b/example/registry/nacos/http/server/server.go index b2a2c6118..a7abece76 100644 --- a/example/registry/nacos/http/server/server.go +++ b/example/registry/nacos/http/server/server.go @@ -7,10 +7,11 @@ package main import ( - "github.com/gogf/gf/contrib/registry/nacos/v2" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/net/ghttp" "github.com/gogf/gf/v2/net/gsvc" + + "github.com/gogf/gf/contrib/registry/nacos/v2" ) func main() { diff --git a/example/registry/polaris/client/client.go b/example/registry/polaris/client/client.go index fb73bc93e..183e1a6b4 100644 --- a/example/registry/polaris/client/client.go +++ b/example/registry/polaris/client/client.go @@ -14,10 +14,11 @@ import ( "github.com/polarismesh/polaris-go/api" "github.com/polarismesh/polaris-go/pkg/config" - "github.com/gogf/gf/contrib/registry/polaris/v2" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/net/gsvc" "github.com/gogf/gf/v2/os/gctx" + + "github.com/gogf/gf/contrib/registry/polaris/v2" ) func main() { diff --git a/example/registry/polaris/server/server.go b/example/registry/polaris/server/server.go index c6d9794f3..5a15ebb1b 100644 --- a/example/registry/polaris/server/server.go +++ b/example/registry/polaris/server/server.go @@ -12,10 +12,11 @@ import ( "github.com/polarismesh/polaris-go/api" "github.com/polarismesh/polaris-go/pkg/config" - "github.com/gogf/gf/contrib/registry/polaris/v2" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/net/ghttp" "github.com/gogf/gf/v2/net/gsvc" + + "github.com/gogf/gf/contrib/registry/polaris/v2" ) func main() { diff --git a/example/rpc/grpcx/balancer/client/client.go b/example/rpc/grpcx/balancer/client/client.go index 5a3ba518c..99d785341 100644 --- a/example/rpc/grpcx/balancer/client/client.go +++ b/example/rpc/grpcx/balancer/client/client.go @@ -9,10 +9,12 @@ package main import ( "context" - "github.com/gogf/gf/contrib/rpc/grpcx/v2" - "github.com/gogf/gf/example/rpc/grpcx/balancer/protobuf" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gctx" + + "github.com/gogf/gf/contrib/rpc/grpcx/v2" + + "github.com/gogf/gf/example/rpc/grpcx/balancer/protobuf" ) func main() { diff --git a/example/rpc/grpcx/balancer/controller/helloworld.go b/example/rpc/grpcx/balancer/controller/helloworld.go index e30161523..0dc0bbad1 100644 --- a/example/rpc/grpcx/balancer/controller/helloworld.go +++ b/example/rpc/grpcx/balancer/controller/helloworld.go @@ -10,6 +10,7 @@ import ( "context" "github.com/gogf/gf/contrib/rpc/grpcx/v2" + "github.com/gogf/gf/example/rpc/grpcx/balancer/protobuf" ) diff --git a/example/rpc/grpcx/balancer/server/server.go b/example/rpc/grpcx/balancer/server/server.go index 0a938c599..df1c276d1 100644 --- a/example/rpc/grpcx/balancer/server/server.go +++ b/example/rpc/grpcx/balancer/server/server.go @@ -8,6 +8,7 @@ package main import ( "github.com/gogf/gf/contrib/rpc/grpcx/v2" + "github.com/gogf/gf/example/rpc/grpcx/balancer/controller" ) diff --git a/example/rpc/grpcx/basic/client/client.go b/example/rpc/grpcx/basic/client/client.go index f2779bf86..e224d601a 100644 --- a/example/rpc/grpcx/basic/client/client.go +++ b/example/rpc/grpcx/basic/client/client.go @@ -7,10 +7,12 @@ package main import ( - "github.com/gogf/gf/contrib/rpc/grpcx/v2" - "github.com/gogf/gf/example/rpc/grpcx/basic/protobuf" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gctx" + + "github.com/gogf/gf/contrib/rpc/grpcx/v2" + + "github.com/gogf/gf/example/rpc/grpcx/basic/protobuf" ) func main() { diff --git a/example/rpc/grpcx/basic/controller/helloworld.go b/example/rpc/grpcx/basic/controller/helloworld.go index 4441e5fd0..10b5e900f 100644 --- a/example/rpc/grpcx/basic/controller/helloworld.go +++ b/example/rpc/grpcx/basic/controller/helloworld.go @@ -10,6 +10,7 @@ import ( "context" "github.com/gogf/gf/contrib/rpc/grpcx/v2" + "github.com/gogf/gf/example/rpc/grpcx/basic/protobuf" ) diff --git a/example/rpc/grpcx/basic/server/server.go b/example/rpc/grpcx/basic/server/server.go index 5afdeb44c..524ee1b4e 100644 --- a/example/rpc/grpcx/basic/server/server.go +++ b/example/rpc/grpcx/basic/server/server.go @@ -8,6 +8,7 @@ package main import ( "github.com/gogf/gf/contrib/rpc/grpcx/v2" + "github.com/gogf/gf/example/rpc/grpcx/basic/controller" ) diff --git a/example/rpc/grpcx/ctx/client/client.go b/example/rpc/grpcx/ctx/client/client.go index 1ce674329..2a5086908 100644 --- a/example/rpc/grpcx/ctx/client/client.go +++ b/example/rpc/grpcx/ctx/client/client.go @@ -7,10 +7,12 @@ package main import ( - "github.com/gogf/gf/contrib/rpc/grpcx/v2" - "github.com/gogf/gf/example/rpc/grpcx/ctx/protobuf" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gctx" + + "github.com/gogf/gf/contrib/rpc/grpcx/v2" + + "github.com/gogf/gf/example/rpc/grpcx/ctx/protobuf" ) func main() { diff --git a/example/rpc/grpcx/ctx/controller/helloworld.go b/example/rpc/grpcx/ctx/controller/helloworld.go index 03a3240b8..839f0b8e5 100644 --- a/example/rpc/grpcx/ctx/controller/helloworld.go +++ b/example/rpc/grpcx/ctx/controller/helloworld.go @@ -9,9 +9,11 @@ package controller import ( "context" - "github.com/gogf/gf/contrib/rpc/grpcx/v2" - "github.com/gogf/gf/example/rpc/grpcx/ctx/protobuf" "github.com/gogf/gf/v2/frame/g" + + "github.com/gogf/gf/contrib/rpc/grpcx/v2" + + "github.com/gogf/gf/example/rpc/grpcx/ctx/protobuf" ) type Controller struct { diff --git a/example/rpc/grpcx/ctx/server/server.go b/example/rpc/grpcx/ctx/server/server.go index 83aa82af8..401e2319d 100644 --- a/example/rpc/grpcx/ctx/server/server.go +++ b/example/rpc/grpcx/ctx/server/server.go @@ -8,6 +8,7 @@ package main import ( "github.com/gogf/gf/contrib/rpc/grpcx/v2" + "github.com/gogf/gf/example/rpc/grpcx/ctx/controller" ) diff --git a/example/rpc/grpcx/rawgrpc/client/client.go b/example/rpc/grpcx/rawgrpc/client/client.go index b9557d483..e240d52af 100644 --- a/example/rpc/grpcx/rawgrpc/client/client.go +++ b/example/rpc/grpcx/rawgrpc/client/client.go @@ -13,14 +13,15 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" - "github.com/gogf/gf/contrib/registry/file/v2" - "github.com/gogf/gf/contrib/rpc/grpcx/v2" - "github.com/gogf/gf/v2/os/gfile" - - pb "github.com/gogf/gf/example/rpc/grpcx/rawgrpc/helloworld" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/net/gsvc" "github.com/gogf/gf/v2/os/gctx" + "github.com/gogf/gf/v2/os/gfile" + + "github.com/gogf/gf/contrib/registry/file/v2" + "github.com/gogf/gf/contrib/rpc/grpcx/v2" + + pb "github.com/gogf/gf/example/rpc/grpcx/rawgrpc/helloworld" ) func main() { diff --git a/example/rpc/grpcx/rawgrpc/server/server.go b/example/rpc/grpcx/rawgrpc/server/server.go index 20edb56a6..3000a6aa9 100644 --- a/example/rpc/grpcx/rawgrpc/server/server.go +++ b/example/rpc/grpcx/rawgrpc/server/server.go @@ -13,14 +13,16 @@ import ( "google.golang.org/grpc" - "github.com/gogf/gf/contrib/registry/file/v2" - "github.com/gogf/gf/example/rpc/grpcx/rawgrpc/helloworld" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/net/gipv4" "github.com/gogf/gf/v2/net/gsvc" "github.com/gogf/gf/v2/net/gtcp" "github.com/gogf/gf/v2/os/gctx" "github.com/gogf/gf/v2/os/gfile" + + "github.com/gogf/gf/contrib/registry/file/v2" + + "github.com/gogf/gf/example/rpc/grpcx/rawgrpc/helloworld" ) type GreetingServer struct { diff --git a/example/rpc/grpcx/resolver/client/client.go b/example/rpc/grpcx/resolver/client/client.go index ae2fefc4f..3623852f5 100644 --- a/example/rpc/grpcx/resolver/client/client.go +++ b/example/rpc/grpcx/resolver/client/client.go @@ -7,11 +7,13 @@ package main import ( - "github.com/gogf/gf/contrib/registry/etcd/v2" - "github.com/gogf/gf/contrib/rpc/grpcx/v2" - "github.com/gogf/gf/example/rpc/grpcx/resolver/protobuf" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gctx" + + "github.com/gogf/gf/contrib/registry/etcd/v2" + "github.com/gogf/gf/contrib/rpc/grpcx/v2" + + "github.com/gogf/gf/example/rpc/grpcx/resolver/protobuf" ) func main() { diff --git a/example/rpc/grpcx/resolver/controller/helloworld.go b/example/rpc/grpcx/resolver/controller/helloworld.go index 797a4580a..08bb90fc2 100644 --- a/example/rpc/grpcx/resolver/controller/helloworld.go +++ b/example/rpc/grpcx/resolver/controller/helloworld.go @@ -10,6 +10,7 @@ import ( "context" "github.com/gogf/gf/contrib/rpc/grpcx/v2" + "github.com/gogf/gf/example/rpc/grpcx/resolver/protobuf" ) diff --git a/example/rpc/grpcx/resolver/server/server.go b/example/rpc/grpcx/resolver/server/server.go index 7d8f1beb6..dc1fe080b 100644 --- a/example/rpc/grpcx/resolver/server/server.go +++ b/example/rpc/grpcx/resolver/server/server.go @@ -9,6 +9,7 @@ package main import ( "github.com/gogf/gf/contrib/registry/etcd/v2" "github.com/gogf/gf/contrib/rpc/grpcx/v2" + "github.com/gogf/gf/example/rpc/grpcx/resolver/controller" ) diff --git a/example/trace/grpc-with-db/client/client.go b/example/trace/grpc-with-db/client/client.go index 22823eca9..f5a286ba3 100644 --- a/example/trace/grpc-with-db/client/client.go +++ b/example/trace/grpc-with-db/client/client.go @@ -7,13 +7,15 @@ package main import ( - "github.com/gogf/gf/contrib/registry/etcd/v2" - "github.com/gogf/gf/contrib/rpc/grpcx/v2" - "github.com/gogf/gf/contrib/trace/otlpgrpc/v2" - "github.com/gogf/gf/example/trace/grpc-with-db/protobuf/user" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/net/gtrace" "github.com/gogf/gf/v2/os/gctx" + + "github.com/gogf/gf/contrib/registry/etcd/v2" + "github.com/gogf/gf/contrib/rpc/grpcx/v2" + "github.com/gogf/gf/contrib/trace/otlpgrpc/v2" + + "github.com/gogf/gf/example/trace/grpc-with-db/protobuf/user" ) const ( diff --git a/example/trace/grpc-with-db/server/server.go b/example/trace/grpc-with-db/server/server.go index 6ef4d3a3c..3c11655f2 100644 --- a/example/trace/grpc-with-db/server/server.go +++ b/example/trace/grpc-with-db/server/server.go @@ -7,21 +7,23 @@ package main import ( - _ "github.com/gogf/gf/contrib/drivers/mysql/v2" - _ "github.com/gogf/gf/contrib/nosql/redis/v2" - "github.com/gogf/gf/contrib/registry/etcd/v2" - "github.com/gogf/gf/contrib/trace/otlpgrpc/v2" - "github.com/gogf/gf/example/trace/grpc-with-db/protobuf/user" - "context" "fmt" "time" - "github.com/gogf/gf/contrib/rpc/grpcx/v2" + _ "github.com/gogf/gf/contrib/drivers/mysql/v2" + _ "github.com/gogf/gf/contrib/nosql/redis/v2" + "github.com/gogf/gf/v2/database/gdb" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gcache" "github.com/gogf/gf/v2/os/gctx" + + "github.com/gogf/gf/contrib/registry/etcd/v2" + "github.com/gogf/gf/contrib/rpc/grpcx/v2" + "github.com/gogf/gf/contrib/trace/otlpgrpc/v2" + + "github.com/gogf/gf/example/trace/grpc-with-db/protobuf/user" ) // Controller is the gRPC controller for user management. diff --git a/example/trace/http-with-db/client/client.go b/example/trace/http-with-db/client/client.go index 24afdcc70..393ed3e95 100644 --- a/example/trace/http-with-db/client/client.go +++ b/example/trace/http-with-db/client/client.go @@ -7,12 +7,13 @@ package main import ( - "github.com/gogf/gf/contrib/trace/otlphttp/v2" "github.com/gogf/gf/v2/database/gdb" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/net/ghttp" "github.com/gogf/gf/v2/net/gtrace" "github.com/gogf/gf/v2/os/gctx" + + "github.com/gogf/gf/contrib/trace/otlphttp/v2" ) const ( diff --git a/example/trace/http-with-db/server/server.go b/example/trace/http-with-db/server/server.go index fd31dba16..ce467e109 100644 --- a/example/trace/http-with-db/server/server.go +++ b/example/trace/http-with-db/server/server.go @@ -12,12 +12,14 @@ import ( "time" _ "github.com/gogf/gf/contrib/drivers/mysql/v2" - "github.com/gogf/gf/contrib/trace/otlphttp/v2" + "github.com/gogf/gf/v2/database/gdb" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/net/ghttp" "github.com/gogf/gf/v2/os/gcache" "github.com/gogf/gf/v2/os/gctx" + + "github.com/gogf/gf/contrib/trace/otlphttp/v2" ) type cTrace struct{} diff --git a/example/trace/http/client/client.go b/example/trace/http/client/client.go index d09226075..8dd746830 100644 --- a/example/trace/http/client/client.go +++ b/example/trace/http/client/client.go @@ -7,10 +7,11 @@ package main import ( - "github.com/gogf/gf/contrib/trace/otlphttp/v2" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/net/gtrace" "github.com/gogf/gf/v2/os/gctx" + + "github.com/gogf/gf/contrib/trace/otlphttp/v2" ) const ( diff --git a/example/trace/http/server/server.go b/example/trace/http/server/server.go index 2616df9cd..de3114eac 100644 --- a/example/trace/http/server/server.go +++ b/example/trace/http/server/server.go @@ -7,11 +7,12 @@ package main import ( - "github.com/gogf/gf/contrib/trace/otlphttp/v2" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/net/ghttp" "github.com/gogf/gf/v2/net/gtrace" "github.com/gogf/gf/v2/os/gctx" + + "github.com/gogf/gf/contrib/trace/otlphttp/v2" ) const ( diff --git a/example/trace/inprocess-grpc/main.go b/example/trace/inprocess-grpc/main.go index bf8052ab6..1e084b16c 100644 --- a/example/trace/inprocess-grpc/main.go +++ b/example/trace/inprocess-grpc/main.go @@ -9,11 +9,12 @@ package main import ( "context" - "github.com/gogf/gf/contrib/trace/otlpgrpc/v2" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/net/gtrace" "github.com/gogf/gf/v2/os/gctx" "github.com/gogf/gf/v2/util/gutil" + + "github.com/gogf/gf/contrib/trace/otlpgrpc/v2" ) const ( diff --git a/example/trace/inprocess/main.go b/example/trace/inprocess/main.go index 3e603e037..c7e7ffbda 100644 --- a/example/trace/inprocess/main.go +++ b/example/trace/inprocess/main.go @@ -9,11 +9,12 @@ package main import ( "context" - "github.com/gogf/gf/contrib/trace/otlphttp/v2" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/net/gtrace" "github.com/gogf/gf/v2/os/gctx" "github.com/gogf/gf/v2/util/gutil" + + "github.com/gogf/gf/contrib/trace/otlphttp/v2" ) const ( diff --git a/example/trace/otlp/grpc/main.go b/example/trace/otlp/grpc/main.go index 8703d04b9..a20e63dba 100644 --- a/example/trace/otlp/grpc/main.go +++ b/example/trace/otlp/grpc/main.go @@ -7,11 +7,11 @@ package main import ( - "github.com/gogf/gf/contrib/trace/otlpgrpc/v2" - "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/net/gtrace" "github.com/gogf/gf/v2/os/gctx" + + "github.com/gogf/gf/contrib/trace/otlpgrpc/v2" ) const ( diff --git a/example/trace/otlp/http/main.go b/example/trace/otlp/http/main.go index 4994f882e..aa1454eba 100644 --- a/example/trace/otlp/http/main.go +++ b/example/trace/otlp/http/main.go @@ -7,10 +7,11 @@ package main import ( - "github.com/gogf/gf/contrib/trace/otlphttp/v2" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/net/gtrace" "github.com/gogf/gf/v2/os/gctx" + + "github.com/gogf/gf/contrib/trace/otlphttp/v2" ) const ( diff --git a/example/trace/provider/grpc/main.go b/example/trace/provider/grpc/main.go index 7d5606f1d..40a9a5aaa 100644 --- a/example/trace/provider/grpc/main.go +++ b/example/trace/provider/grpc/main.go @@ -18,10 +18,10 @@ import ( semconv "go.opentelemetry.io/otel/semconv/v1.24.0" "google.golang.org/grpc/encoding/gzip" - "github.com/gogf/gf/example/trace/provider/internal" - "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gctx" + + "github.com/gogf/gf/example/trace/provider/internal" ) func main() { diff --git a/example/trace/provider/http/main.go b/example/trace/provider/http/main.go index 6f66c7eb9..c6f63a635 100644 --- a/example/trace/provider/http/main.go +++ b/example/trace/provider/http/main.go @@ -16,9 +16,10 @@ import ( "go.opentelemetry.io/otel/sdk/trace" semconv "go.opentelemetry.io/otel/semconv/v1.24.0" - "github.com/gogf/gf/example/trace/provider/internal" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gctx" + + "github.com/gogf/gf/example/trace/provider/internal" ) func main() { diff --git a/i18n/gi18n/gi18n_z_unit_test.go b/i18n/gi18n/gi18n_z_unit_test.go index af44d226b..2a1d672a4 100644 --- a/i18n/gi18n/gi18n_z_unit_test.go +++ b/i18n/gi18n/gi18n_z_unit_test.go @@ -7,17 +7,15 @@ package gi18n_test import ( - "time" - - "github.com/gogf/gf/v2/encoding/gbase64" - "github.com/gogf/gf/v2/os/gctx" - "context" "testing" + "time" "github.com/gogf/gf/v2/debug/gdebug" + "github.com/gogf/gf/v2/encoding/gbase64" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/i18n/gi18n" + "github.com/gogf/gf/v2/os/gctx" "github.com/gogf/gf/v2/os/gfile" "github.com/gogf/gf/v2/os/gres" "github.com/gogf/gf/v2/os/gtime" diff --git a/internal/errors/errors.go b/internal/errors/errors.go index 8ab919c12..b1f83aa5e 100644 --- a/internal/errors/errors.go +++ b/internal/errors/errors.go @@ -31,11 +31,9 @@ const ( StackModeDetail StackMode = "detail" ) -var ( - // stackModeConfigured is the configured error stack mode variable. - // It is brief stack mode in default. - stackModeConfigured = StackModeBrief -) +// stackModeConfigured is the configured error stack mode variable. +// It is brief stack mode in default. +var stackModeConfigured = StackModeBrief func init() { // Deprecated. diff --git a/internal/utils/utils_debug.go b/internal/utils/utils_debug.go index 5584341b8..9b26e78b8 100644 --- a/internal/utils/utils_debug.go +++ b/internal/utils/utils_debug.go @@ -15,10 +15,8 @@ const ( commandEnvKeyForDebugKey = "gf.debug" ) -var ( - // isDebugEnabled marks whether GoFrame debug mode is enabled. - isDebugEnabled = false -) +// isDebugEnabled marks whether GoFrame debug mode is enabled. +var isDebugEnabled = false func init() { // Debugging configured. diff --git a/internal/utils/utils_is.go b/internal/utils/utils_is.go index e7fa2e338..01fe759ee 100644 --- a/internal/utils/utils_is.go +++ b/internal/utils/utils_is.go @@ -85,11 +85,11 @@ func IsMap(value interface{}) bool { // IsStruct checks whether `value` is type of struct. func IsStruct(value interface{}) bool { - var reflectType = reflect.TypeOf(value) + reflectType := reflect.TypeOf(value) if reflectType == nil { return false } - var reflectKind = reflectType.Kind() + reflectKind := reflectType.Kind() for reflectKind == reflect.Ptr { reflectType = reflectType.Elem() reflectKind = reflectType.Kind() diff --git a/internal/utils/utils_str.go b/internal/utils/utils_str.go index 9f1089d50..01d478190 100644 --- a/internal/utils/utils_str.go +++ b/internal/utils/utils_str.go @@ -11,20 +11,18 @@ import ( "strings" ) -var ( - // DefaultTrimChars are the characters which are stripped by Trim* functions in default. - DefaultTrimChars = string([]byte{ - '\t', // Tab. - '\v', // Vertical tab. - '\n', // New line (line feed). - '\r', // Carriage return. - '\f', // New page. - ' ', // Ordinary space. - 0x00, // NUL-byte. - 0x85, // Delete. - 0xA0, // Non-breaking space. - }) -) +// DefaultTrimChars are the characters which are stripped by Trim* functions in default. +var DefaultTrimChars = string([]byte{ + '\t', // Tab. + '\v', // Vertical tab. + '\n', // New line (line feed). + '\r', // Carriage return. + '\f', // New page. + ' ', // Ordinary space. + 0x00, // NUL-byte. + 0x85, // Delete. + 0xA0, // Non-breaking space. +}) // IsLetterUpper checks whether the given byte b is in upper case. func IsLetterUpper(b byte) bool { @@ -101,7 +99,7 @@ func ReplaceByMap(origin string, replaces map[string]string) string { // RemoveSymbols removes all symbols from string and lefts only numbers and letters. func RemoveSymbols(s string) string { - var b = make([]rune, 0, len(s)) + b := make([]rune, 0, len(s)) for _, c := range s { if c > 127 { b = append(b, c) diff --git a/net/ghttp/ghttp_z_unit_feature_https_test.go b/net/ghttp/ghttp_z_unit_feature_https_test.go index 35c269982..fe728d2f1 100644 --- a/net/ghttp/ghttp_z_unit_feature_https_test.go +++ b/net/ghttp/ghttp_z_unit_feature_https_test.go @@ -7,12 +7,12 @@ package ghttp_test import ( - _ "github.com/gogf/gf/v2/net/ghttp/testdata/https/packed" - "fmt" "testing" "time" + _ "github.com/gogf/gf/v2/net/ghttp/testdata/https/packed" + "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/net/ghttp" "github.com/gogf/gf/v2/net/gtcp" diff --git a/net/ghttp/ghttp_z_unit_feature_pprof_test.go b/net/ghttp/ghttp_z_unit_feature_pprof_test.go index d6b355e7e..ca8d428cb 100644 --- a/net/ghttp/ghttp_z_unit_feature_pprof_test.go +++ b/net/ghttp/ghttp_z_unit_feature_pprof_test.go @@ -13,9 +13,10 @@ import ( "testing" "time" + . "github.com/gogf/gf/v2/test/gtest" + "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/net/ghttp" - . "github.com/gogf/gf/v2/test/gtest" "github.com/gogf/gf/v2/util/guid" ) diff --git a/net/ghttp/ghttp_z_unit_feature_request_file_test.go b/net/ghttp/ghttp_z_unit_feature_request_file_test.go index 9d3544617..f2318f3c2 100644 --- a/net/ghttp/ghttp_z_unit_feature_request_file_test.go +++ b/net/ghttp/ghttp_z_unit_feature_request_file_test.go @@ -13,9 +13,8 @@ import ( "testing" "time" - "github.com/gogf/gf/v2/internal/json" - "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/internal/json" "github.com/gogf/gf/v2/net/ghttp" "github.com/gogf/gf/v2/os/gfile" "github.com/gogf/gf/v2/os/gtime" diff --git a/net/ghttp/ghttp_z_unit_feature_response_test.go b/net/ghttp/ghttp_z_unit_feature_response_test.go index c0e2b565b..6615baada 100644 --- a/net/ghttp/ghttp_z_unit_feature_response_test.go +++ b/net/ghttp/ghttp_z_unit_feature_response_test.go @@ -14,11 +14,10 @@ import ( "time" "github.com/gogf/gf/v2/encoding/gxml" - "github.com/gogf/gf/v2/internal/json" - "github.com/gogf/gf/v2/os/gview" - "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/internal/json" "github.com/gogf/gf/v2/net/ghttp" + "github.com/gogf/gf/v2/os/gview" "github.com/gogf/gf/v2/test/gtest" "github.com/gogf/gf/v2/util/guid" ) diff --git a/net/gtrace/gtrace.go b/net/gtrace/gtrace.go index 15f6e128e..d1e72273b 100644 --- a/net/gtrace/gtrace.go +++ b/net/gtrace/gtrace.go @@ -15,7 +15,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/propagation" - semconv "go.opentelemetry.io/otel/semconv/v1.18.0" + semconv "go.opentelemetry.io/otel/semconv/v1.24.0" "go.opentelemetry.io/otel/trace" "github.com/gogf/gf/v2/container/gmap" diff --git a/net/gtrace/gtrace_content.go b/net/gtrace/gtrace_content.go index ccb82601c..7d596426a 100644 --- a/net/gtrace/gtrace_content.go +++ b/net/gtrace/gtrace_content.go @@ -11,7 +11,6 @@ import ( "strings" "github.com/gogf/gf/v2/encoding/gcompress" - "github.com/gogf/gf/v2/text/gstr" ) diff --git a/net/gtrace/gtrace_z_unit_test.go b/net/gtrace/gtrace_z_unit_test.go index 700c587dc..604fd7f6e 100644 --- a/net/gtrace/gtrace_z_unit_test.go +++ b/net/gtrace/gtrace_z_unit_test.go @@ -13,7 +13,6 @@ import ( "testing" "github.com/gogf/gf/v2/encoding/gcompress" - "github.com/gogf/gf/v2/net/gtrace" "github.com/gogf/gf/v2/test/gtest" "github.com/gogf/gf/v2/text/gstr" diff --git a/os/gcache/gcache_adapter_memory_lru.go b/os/gcache/gcache_adapter_memory_lru.go index 318bb2171..cf7f71c43 100644 --- a/os/gcache/gcache_adapter_memory_lru.go +++ b/os/gcache/gcache_adapter_memory_lru.go @@ -7,9 +7,10 @@ package gcache import ( + "sync" + "github.com/gogf/gf/v2/container/glist" "github.com/gogf/gf/v2/container/gmap" - "sync" ) // memoryLru holds LRU info. diff --git a/os/gcache/gcache_cache.go b/os/gcache/gcache_cache.go index 7cae6c7c8..939227731 100644 --- a/os/gcache/gcache_cache.go +++ b/os/gcache/gcache_cache.go @@ -8,6 +8,7 @@ package gcache import ( "context" + "github.com/gogf/gf/v2/util/gconv" ) diff --git a/os/gfsnotify/gfsnotify_watcher_loop.go b/os/gfsnotify/gfsnotify_watcher_loop.go index dca551fdf..dc12d5763 100644 --- a/os/gfsnotify/gfsnotify_watcher_loop.go +++ b/os/gfsnotify/gfsnotify_watcher_loop.go @@ -8,10 +8,10 @@ package gfsnotify import ( "context" - "github.com/gogf/gf/v2/errors/gcode" - "github.com/gogf/gf/v2/errors/gerror" "github.com/gogf/gf/v2/container/glist" + "github.com/gogf/gf/v2/errors/gcode" + "github.com/gogf/gf/v2/errors/gerror" "github.com/gogf/gf/v2/internal/intlog" ) diff --git a/os/gres/gres_z_unit_test.go b/os/gres/gres_z_unit_test.go index 3f6cd4169..4b0653730 100644 --- a/os/gres/gres_z_unit_test.go +++ b/os/gres/gres_z_unit_test.go @@ -7,11 +7,11 @@ package gres_test import ( - _ "github.com/gogf/gf/v2/os/gres/testdata/data" - "strings" "testing" + _ "github.com/gogf/gf/v2/os/gres/testdata/data" + "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gfile" "github.com/gogf/gf/v2/os/gres" diff --git a/os/gstructs/gstructs_field.go b/os/gstructs/gstructs_field.go index 639291fd2..5fc234242 100644 --- a/os/gstructs/gstructs_field.go +++ b/os/gstructs/gstructs_field.go @@ -50,9 +50,7 @@ func (f *Field) TagStr() string { // TagMap returns all the tag of the field along with its value string as map. func (f *Field) TagMap() map[string]string { - var ( - data = ParseTag(f.TagStr()) - ) + data := ParseTag(f.TagStr()) for k, v := range data { data[k] = utils.StripSlashes(gtag.Parse(v)) } diff --git a/os/gstructs/gstructs_field_tag.go b/os/gstructs/gstructs_field_tag.go index c08d98c0f..fa7211515 100644 --- a/os/gstructs/gstructs_field_tag.go +++ b/os/gstructs/gstructs_field_tag.go @@ -98,7 +98,7 @@ func (f *Field) TagIn() string { // TagPriorityName checks and returns tag name that matches the name item in `gtag.StructTagPriority`. // It or else returns attribute field Name if it doesn't have a tag name by `gtag.StructsTagPriority`. func (f *Field) TagPriorityName() string { - var name = f.Name() + name := f.Name() for _, tagName := range gtag.StructTagPriority { if tagValue := f.Tag(tagName); tagValue != "" { name = tagValue diff --git a/os/gtime/gtime.go b/os/gtime/gtime.go index ec71dcbdd..f09ed0eff 100644 --- a/os/gtime/gtime.go +++ b/os/gtime/gtime.go @@ -377,9 +377,7 @@ func ParseTimeFromContent(content string, format ...string) *Time { // // Very note that it supports unit "d" more than function time.ParseDuration. func ParseDuration(s string) (duration time.Duration, err error) { - var ( - num int64 - ) + var num int64 if utils.IsNumeric(s) { num, err = strconv.ParseInt(s, 10, 64) if err != nil { diff --git a/os/gtimer/gtimer_entry.go b/os/gtimer/gtimer_entry.go index fd7668898..791b4401c 100644 --- a/os/gtimer/gtimer_entry.go +++ b/os/gtimer/gtimer_entry.go @@ -9,9 +9,8 @@ package gtimer import ( "context" - "github.com/gogf/gf/v2/errors/gcode" - "github.com/gogf/gf/v2/container/gtype" + "github.com/gogf/gf/v2/errors/gcode" "github.com/gogf/gf/v2/errors/gerror" ) diff --git a/util/grand/grand_buffer.go b/util/grand/grand_buffer.go index 4f527babc..75d1fb724 100644 --- a/util/grand/grand_buffer.go +++ b/util/grand/grand_buffer.go @@ -18,11 +18,9 @@ const ( bufferChanSize = 10000 ) -var ( - // bufferChan is the buffer for random bytes, - // every item storing 4 bytes. - bufferChan = make(chan []byte, bufferChanSize) -) +// bufferChan is the buffer for random bytes, +// every item storing 4 bytes. +var bufferChan = make(chan []byte, bufferChanSize) func init() { go asyncProducingRandomBufferBytesLoop() diff --git a/util/gtag/gtag_enums.go b/util/gtag/gtag_enums.go index 2c9d65c3a..10a4dbe97 100644 --- a/util/gtag/gtag_enums.go +++ b/util/gtag/gtag_enums.go @@ -10,10 +10,8 @@ import ( "github.com/gogf/gf/v2/internal/json" ) -var ( - // Type name => enums json. - enumsMap = make(map[string]json.RawMessage) -) +// Type name => enums json. +var enumsMap = make(map[string]json.RawMessage) // SetGlobalEnums sets the global enums into package. // Note that this operation is not concurrent safety. diff --git a/util/gutil/gutil_z_example_test.go b/util/gutil/gutil_z_example_test.go index b885e06c7..aeb549225 100644 --- a/util/gutil/gutil_z_example_test.go +++ b/util/gutil/gutil_z_example_test.go @@ -8,6 +8,7 @@ package gutil_test import ( "fmt" + "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/util/gutil" )