Skip to content

Commit 820bd78

Browse files
committed
chore: adjust dep
1 parent 9debf1f commit 820bd78

File tree

6 files changed

+108
-2395
lines changed

6 files changed

+108
-2395
lines changed

Diff for: .golangci.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
run:
2-
go: '1.16'
2+
go: '1.19'
33
concurrency: 4
44
timeout: 5m
55
tests: true

Diff for: Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
proxy:
44
@go env -w GO111MODULE="on"
55
@go env -w GOPROXY="https://goproxy.cn,direct"
6+
@go env -w GOPRIVATE="github.com/sliveryou/goctl-swagger"
67
@git config --global url."[email protected]:sliveryou/goctl-swagger.git".insteadOf "https://github.com/sliveryou/goctl-swagger.git"
78

89
tidy:

Diff for: README.md

+4-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# 自定义 goctl-swagger
22

3-
43
### 1. goctl-swagger 修复分支
54

65
1. 修复:当存在第三方 tag 时,生成的参数名称错误的问题
@@ -16,18 +15,16 @@
1615

1716
### 2. 编译 goctl-swagger 插件
1817

18+
**需要 go 1.19 以上版本编译安装**
19+
1920
```bash
2021
# 可选:自行编译安装:
2122
$ git clone https://github.com/sliveryou/goctl-swagger.git
2223
$ cd goctl-swagger
2324
$ go install
2425

25-
# 推荐:
26-
# 如果 go 版本在 1.16 以前,使用如下命令安装:
27-
$ GO111MODULE=on go get -u github.com/sliveryou/goctl-swagger@latest
28-
29-
# 如果 go 版本在 1.16 及以后,使用如下命令安装:
30-
$ GO111MODULE=on go install github.com/sliveryou/goctl-swagger@latest
26+
# 推荐:使用如下命令安装:
27+
$ go install github.com/sliveryou/goctl-swagger@latest
3128
```
3229

3330
### 3. goctl-swagger 使用说明

Diff for: generate/parser.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ func renderServiceRoutes(service spec.Service, groups []spec.Group, paths swagge
169169
part := p[i]
170170
if strings.Contains(part, ":") {
171171
key := strings.TrimPrefix(p[i], ":")
172-
path = strings.Replace(path, fmt.Sprintf(":%s", key), fmt.Sprintf("{%s}", key), 1)
172+
path = strings.Replace(path, ":"+key, "{"+key+"}", 1)
173173
spo := swaggerParameterObject{
174174
Name: key,
175175
In: "path",
@@ -256,7 +256,7 @@ func renderServiceRoutes(service spec.Service, groups []spec.Group, paths swagge
256256
}
257257
}
258258
if hasBody && containJson {
259-
reqRef := fmt.Sprintf("#/definitions/%s", route.RequestType.Name())
259+
reqRef := "#/definitions/" + route.RequestType.Name()
260260

261261
if len(route.RequestType.Name()) > 0 {
262262
schema := swaggerSchemaObject{
@@ -299,9 +299,9 @@ func renderServiceRoutes(service spec.Service, groups []spec.Group, paths swagge
299299
refTypeName = strings.TrimPrefix(refTypeName, "*") // remove array item pointer
300300

301301
respSchema.Type = "array"
302-
respSchema.Items = &swaggerItemsObject{Ref: fmt.Sprintf("#/definitions/%s", refTypeName)}
302+
respSchema.Items = &swaggerItemsObject{Ref: "#/definitions/" + refTypeName}
303303
} else {
304-
respSchema.Ref = fmt.Sprintf("#/definitions/%s", route.ResponseType.Name())
304+
respSchema.Ref = "#/definitions/" + route.ResponseType.Name()
305305
}
306306
}
307307
tags := service.Name
@@ -396,7 +396,7 @@ func renderServiceRoutes(service spec.Service, groups []spec.Group, paths swagge
396396
Description: comment,
397397
Schema: swaggerSchemaObject{
398398
schemaCore: schemaCore{
399-
Ref: fmt.Sprintf("#/definitions/%s", content),
399+
Ref: "#/definitions/" + content,
400400
},
401401
},
402402
}

Diff for: go.mod

+61-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,68 @@
11
module github.com/sliveryou/goctl-swagger
22

3-
go 1.16
3+
go 1.19
44

55
require (
66
github.com/grpc-ecosystem/grpc-gateway v1.16.0
77
github.com/urfave/cli/v2 v2.27.1
8-
github.com/zeromicro/go-zero v1.6.1
9-
github.com/zeromicro/go-zero/tools/goctl v1.6.1
10-
golang.org/x/oauth2 v0.16.0
8+
github.com/zeromicro/go-zero v1.6.2
9+
github.com/zeromicro/go-zero/tools/goctl v1.6.2
10+
golang.org/x/oauth2 v0.17.0
11+
)
12+
13+
require (
14+
github.com/beorn7/perks v1.0.1 // indirect
15+
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
16+
github.com/cespare/xxhash/v2 v2.2.0 // indirect
17+
github.com/cpuguy83/go-md2man/v2 v2.0.3 // indirect
18+
github.com/fatih/color v1.16.0 // indirect
19+
github.com/fatih/structtag v1.2.0 // indirect
20+
github.com/ghodss/yaml v1.0.0 // indirect
21+
github.com/go-logr/logr v1.3.0 // indirect
22+
github.com/go-logr/stdr v1.2.2 // indirect
23+
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
24+
github.com/golang/glog v1.1.2 // indirect
25+
github.com/golang/protobuf v1.5.3 // indirect
26+
github.com/google/uuid v1.6.0 // indirect
27+
github.com/gookit/color v1.5.4 // indirect
28+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.0 // indirect
29+
github.com/inconshreveable/mousetrap v1.1.0 // indirect
30+
github.com/mattn/go-colorable v0.1.13 // indirect
31+
github.com/mattn/go-isatty v0.0.20 // indirect
32+
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
33+
github.com/openzipkin/zipkin-go v0.4.2 // indirect
34+
github.com/pelletier/go-toml/v2 v2.1.1 // indirect
35+
github.com/prometheus/client_golang v1.18.0 // indirect
36+
github.com/prometheus/client_model v0.5.0 // indirect
37+
github.com/prometheus/common v0.45.0 // indirect
38+
github.com/prometheus/procfs v0.12.0 // indirect
39+
github.com/russross/blackfriday/v2 v2.1.0 // indirect
40+
github.com/spaolacci/murmur3 v1.1.0 // indirect
41+
github.com/spf13/cobra v1.8.0 // indirect
42+
github.com/spf13/pflag v1.0.5 // indirect
43+
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 // indirect
44+
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
45+
github.com/zeromicro/antlr v0.0.1 // indirect
46+
go.opentelemetry.io/otel v1.19.0 // indirect
47+
go.opentelemetry.io/otel/exporters/jaeger v1.17.0 // indirect
48+
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 // indirect
49+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.19.0 // indirect
50+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.19.0 // indirect
51+
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.19.0 // indirect
52+
go.opentelemetry.io/otel/exporters/zipkin v1.19.0 // indirect
53+
go.opentelemetry.io/otel/metric v1.19.0 // indirect
54+
go.opentelemetry.io/otel/sdk v1.19.0 // indirect
55+
go.opentelemetry.io/otel/trace v1.19.0 // indirect
56+
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
57+
go.uber.org/automaxprocs v1.5.3 // indirect
58+
golang.org/x/net v0.21.0 // indirect
59+
golang.org/x/sys v0.17.0 // indirect
60+
golang.org/x/text v0.14.0 // indirect
61+
google.golang.org/appengine v1.6.8 // indirect
62+
google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17 // indirect
63+
google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 // indirect
64+
google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17 // indirect
65+
google.golang.org/grpc v1.61.0 // indirect
66+
google.golang.org/protobuf v1.32.0 // indirect
67+
gopkg.in/yaml.v2 v2.4.0 // indirect
1168
)

0 commit comments

Comments
 (0)