From 299e16bed1c5a3466fd36212a810ba97d610ac8d Mon Sep 17 00:00:00 2001 From: houseme Date: Sat, 13 Nov 2021 23:34:16 +0800 Subject: [PATCH] Improved import, by group improt. --- os/gctx/gctx.go | 1 + os/gctx/gctx_test.go | 4 ++-- protocol/goai/goai.go | 3 ++- protocol/goai/goai_parameter.go | 1 + protocol/goai/goai_path.go | 3 ++- protocol/goai/goai_requestbody.go | 3 ++- protocol/goai/goai_response.go | 3 ++- protocol/goai/goai_shema.go | 3 ++- protocol/goai/goai_shemaref.go | 3 ++- protocol/goai/goai_test.go | 21 +++++++++++---------- test/gtest/gtest_util.go | 3 +-- 11 files changed, 28 insertions(+), 20 deletions(-) diff --git a/os/gctx/gctx.go b/os/gctx/gctx.go index ccb2f23d7..c365d415c 100644 --- a/os/gctx/gctx.go +++ b/os/gctx/gctx.go @@ -9,6 +9,7 @@ package gctx import ( "context" + "github.com/gogf/gf/v2/util/guid" ) diff --git a/os/gctx/gctx_test.go b/os/gctx/gctx_test.go index 040fe71ca..e92d12939 100644 --- a/os/gctx/gctx_test.go +++ b/os/gctx/gctx_test.go @@ -8,11 +8,11 @@ package gctx_test import ( "context" - "github.com/gogf/gf/v2/os/gctx" - "github.com/gogf/gf/v2/text/gstr" "testing" + "github.com/gogf/gf/v2/os/gctx" "github.com/gogf/gf/v2/test/gtest" + "github.com/gogf/gf/v2/text/gstr" ) func Test_New(t *testing.T) { diff --git a/protocol/goai/goai.go b/protocol/goai/goai.go index 231123b86..58158e462 100644 --- a/protocol/goai/goai.go +++ b/protocol/goai/goai.go @@ -12,12 +12,13 @@ package goai import ( "context" "fmt" + "reflect" + "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/internal/json" "github.com/gogf/gf/v2/text/gstr" - "reflect" ) // OpenApiV3 is the structure defined from: diff --git a/protocol/goai/goai_parameter.go b/protocol/goai/goai_parameter.go index 23ca40314..234b9a00a 100644 --- a/protocol/goai/goai_parameter.go +++ b/protocol/goai/goai_parameter.go @@ -8,6 +8,7 @@ package goai import ( "fmt" + "github.com/gogf/gf/v2/errors/gcode" "github.com/gogf/gf/v2/errors/gerror" "github.com/gogf/gf/v2/internal/json" diff --git a/protocol/goai/goai_path.go b/protocol/goai/goai_path.go index cd1346761..b9aaeedc6 100644 --- a/protocol/goai/goai_path.go +++ b/protocol/goai/goai_path.go @@ -7,13 +7,14 @@ package goai import ( + "reflect" + "github.com/gogf/gf/v2/errors/gcode" "github.com/gogf/gf/v2/errors/gerror" "github.com/gogf/gf/v2/internal/structs" "github.com/gogf/gf/v2/text/gstr" "github.com/gogf/gf/v2/util/gconv" "github.com/gogf/gf/v2/util/gmeta" - "reflect" ) type Path struct { diff --git a/protocol/goai/goai_requestbody.go b/protocol/goai/goai_requestbody.go index 86ff0504e..d159a6ed2 100644 --- a/protocol/goai/goai_requestbody.go +++ b/protocol/goai/goai_requestbody.go @@ -7,10 +7,11 @@ package goai import ( + "reflect" + "github.com/gogf/gf/v2/internal/json" "github.com/gogf/gf/v2/internal/structs" "github.com/gogf/gf/v2/text/gstr" - "reflect" ) // RequestBody is specified by OpenAPI/Swagger 3.0 standard. diff --git a/protocol/goai/goai_response.go b/protocol/goai/goai_response.go index a5337bda9..5c9940158 100644 --- a/protocol/goai/goai_response.go +++ b/protocol/goai/goai_response.go @@ -7,10 +7,11 @@ package goai import ( + "reflect" + "github.com/gogf/gf/v2/internal/json" "github.com/gogf/gf/v2/internal/structs" "github.com/gogf/gf/v2/text/gstr" - "reflect" ) // Response is specified by OpenAPI/Swagger 3.0 standard. diff --git a/protocol/goai/goai_shema.go b/protocol/goai/goai_shema.go index 7558762ec..1a6192750 100644 --- a/protocol/goai/goai_shema.go +++ b/protocol/goai/goai_shema.go @@ -7,13 +7,14 @@ package goai import ( + "reflect" + "github.com/gogf/gf/v2/errors/gcode" "github.com/gogf/gf/v2/errors/gerror" "github.com/gogf/gf/v2/internal/structs" "github.com/gogf/gf/v2/text/gstr" "github.com/gogf/gf/v2/util/gconv" "github.com/gogf/gf/v2/util/gmeta" - "reflect" ) type Schemas map[string]SchemaRef diff --git a/protocol/goai/goai_shemaref.go b/protocol/goai/goai_shemaref.go index fcd15df2c..9dcd97ff1 100644 --- a/protocol/goai/goai_shemaref.go +++ b/protocol/goai/goai_shemaref.go @@ -7,11 +7,12 @@ package goai import ( + "reflect" + "github.com/gogf/gf/v2/errors/gcode" "github.com/gogf/gf/v2/errors/gerror" "github.com/gogf/gf/v2/internal/json" "github.com/gogf/gf/v2/util/gconv" - "reflect" ) type SchemaRefs []SchemaRef diff --git a/protocol/goai/goai_test.go b/protocol/goai/goai_test.go index e079884fb..9acda5b21 100644 --- a/protocol/goai/goai_test.go +++ b/protocol/goai/goai_test.go @@ -9,11 +9,12 @@ package goai_test import ( "context" "fmt" + "testing" + "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/protocol/goai" "github.com/gogf/gf/v2/test/gtest" "github.com/gogf/gf/v2/util/gmeta" - "testing" ) func Test_Basic(t *testing.T) { @@ -105,7 +106,7 @@ func TestOpenApiV3_Add(t *testing.T) { Object: f, }) t.AssertNil(err) - //fmt.Println(oai.String()) + // fmt.Println(oai.String()) // Schema asserts. t.Assert(len(oai.Components.Schemas), 3) t.Assert(oai.Components.Schemas[`github.com.gogf.gf.v2.protocol.goai_test.CreateResourceReq`].Value.Type, goai.TypeObject) @@ -317,7 +318,7 @@ func TestOpenApiV3_CommonRequest_WithoutDataField_Setting(t *testing.T) { }) t.AssertNil(err) // Schema asserts. - //fmt.Println(oai.String()) + // fmt.Println(oai.String()) t.Assert(len(oai.Components.Schemas), 3) t.Assert(len(oai.Paths), 1) t.Assert(len(oai.Paths["/index"].Put.RequestBody.Value.Content["application/json"].Schema.Value.Properties), 5) @@ -357,7 +358,7 @@ func TestOpenApiV3_CommonRequest_EmptyRequest(t *testing.T) { }) t.AssertNil(err) // Schema asserts. - //fmt.Println(oai.String()) + // fmt.Println(oai.String()) t.Assert(len(oai.Components.Schemas), 3) t.Assert(len(oai.Paths), 1) t.Assert(len(oai.Paths["/index"].Put.RequestBody.Value.Content["application/json"].Schema.Value.Properties), 3) @@ -412,7 +413,7 @@ func TestOpenApiV3_CommonRequest_SubDataField(t *testing.T) { }) t.AssertNil(err) // Schema asserts. - //fmt.Println(oai.String()) + // fmt.Println(oai.String()) t.Assert(len(oai.Components.Schemas), 4) t.Assert(len(oai.Paths), 1) t.Assert(len(oai.Paths["/index"].Put.RequestBody.Value.Content["application/json"].Schema.Value.Properties), 1) @@ -543,7 +544,7 @@ func TestOpenApiV3_CommonResponse_EmptyResponse(t *testing.T) { }) t.AssertNil(err) // Schema asserts. - //fmt.Println(oai.String()) + // fmt.Println(oai.String()) t.Assert(len(oai.Components.Schemas), 3) t.Assert(len(oai.Paths), 1) t.Assert(oai.Paths["/index"].Put.RequestBody.Value.Content["application/json"].Schema.Ref, `github.com.gogf.gf.v2.protocol.goai_test.Req`) @@ -599,7 +600,7 @@ func TestOpenApiV3_CommonResponse_SubDataField(t *testing.T) { }) t.AssertNil(err) // Schema asserts. - //fmt.Println(oai.String()) + // fmt.Println(oai.String()) t.Assert(len(oai.Components.Schemas), 4) t.Assert(len(oai.Paths), 1) t.Assert(len(oai.Paths["/index"].Get.Responses["200"].Value.Content["application/json"].Schema.Value.Properties), 1) @@ -654,7 +655,7 @@ func TestOpenApiV3_ShortTags(t *testing.T) { Object: f, }) t.AssertNil(err) - //fmt.Println(oai.String()) + // fmt.Println(oai.String()) // Schema asserts. t.Assert(len(oai.Components.Schemas), 3) t.Assert(oai.Paths[`/test1/{appId}`].Summary, `CreateResourceReq sum`) @@ -690,7 +691,7 @@ func TestOpenApiV3_HtmlResponse(t *testing.T) { }) t.AssertNil(err) - //fmt.Println(oai.String()) + // fmt.Println(oai.String()) t.Assert(oai.Components.Schemas[`github.com.gogf.gf.v2.protocol.goai_test.Res`].Value.Type, goai.TypeString) }) } @@ -737,7 +738,7 @@ func TestOpenApiV3_HtmlResponseWithCommonResponse(t *testing.T) { }) t.AssertNil(err) - //fmt.Println(oai.String()) + // fmt.Println(oai.String()) t.Assert(oai.Components.Schemas[`github.com.gogf.gf.v2.protocol.goai_test.Res`].Value.Type, goai.TypeString) }) } diff --git a/test/gtest/gtest_util.go b/test/gtest/gtest_util.go index 387a24c33..8f2913fe8 100644 --- a/test/gtest/gtest_util.go +++ b/test/gtest/gtest_util.go @@ -8,7 +8,6 @@ package gtest import ( "fmt" - "github.com/gogf/gf/v2/internal/empty" "io/ioutil" "os" "path/filepath" @@ -16,7 +15,7 @@ import ( "testing" "github.com/gogf/gf/v2/debug/gdebug" - + "github.com/gogf/gf/v2/internal/empty" "github.com/gogf/gf/v2/util/gconv" )