From 21566f1b7a5043b2fa73dcce7e55578555229738 Mon Sep 17 00:00:00 2001 From: Kevin Wan Date: Mon, 20 Feb 2023 23:37:05 +0800 Subject: [PATCH] chore: reformat code (#2903) --- tools/goctl/api/cmd.go | 1 - tools/goctl/api/tsgen/gen.go | 1 - tools/goctl/api/tsgen/genrequest.go | 1 + tools/goctl/api/tsgen/request.ts | 4 ++-- 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/tools/goctl/api/cmd.go b/tools/goctl/api/cmd.go index f5031b57..0da5d9d9 100644 --- a/tools/goctl/api/cmd.go +++ b/tools/goctl/api/cmd.go @@ -2,7 +2,6 @@ package api import ( "github.com/spf13/cobra" - "github.com/zeromicro/go-zero/tools/goctl/api/apigen" "github.com/zeromicro/go-zero/tools/goctl/api/dartgen" "github.com/zeromicro/go-zero/tools/goctl/api/docgen" diff --git a/tools/goctl/api/tsgen/gen.go b/tools/goctl/api/tsgen/gen.go index 90640966..ddad72ac 100644 --- a/tools/goctl/api/tsgen/gen.go +++ b/tools/goctl/api/tsgen/gen.go @@ -7,7 +7,6 @@ import ( "github.com/logrusorgru/aurora" "github.com/spf13/cobra" "github.com/zeromicro/go-zero/core/logx" - "github.com/zeromicro/go-zero/tools/goctl/api/parser" "github.com/zeromicro/go-zero/tools/goctl/util/pathx" ) diff --git a/tools/goctl/api/tsgen/genrequest.go b/tools/goctl/api/tsgen/genrequest.go index 62706e1c..440ae4cb 100644 --- a/tools/goctl/api/tsgen/genrequest.go +++ b/tools/goctl/api/tsgen/genrequest.go @@ -21,5 +21,6 @@ func genRequest(dir string) error { if pathx.FileExists(filename) { return nil } + return os.WriteFile(filename, []byte(requestTemplate), 0644) } diff --git a/tools/goctl/api/tsgen/request.ts b/tools/goctl/api/tsgen/request.ts index 77d7124c..83a63e01 100644 --- a/tools/goctl/api/tsgen/request.ts +++ b/tools/goctl/api/tsgen/request.ts @@ -16,7 +16,6 @@ export type Method = /** * Parse route parameters for responseType - * */ const reg = /:[a-z|A-Z]+/g; @@ -75,6 +74,7 @@ export async function request({ // @ts-ignore ...config }); + return response.json(); } @@ -123,4 +123,4 @@ export const webapi = { } }; -export default webapi \ No newline at end of file +export default webapi