Skip to content

Commit

Permalink
fix: 2024-04-03 21:40:34
Browse files Browse the repository at this point in the history
  • Loading branch information
kooksee committed Apr 3, 2024
1 parent 05d2702 commit 20a76da
Show file tree
Hide file tree
Showing 12 changed files with 51 additions and 51 deletions.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,7 @@ build:
.PHONY: protobuf
protobuf:
protobuild vendor
protobuild gen
protobuild gen

vet:
go vet ./...
4 changes: 2 additions & 2 deletions cmds/protoc-gen-go-sql/internal/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func GenerateFile(gen *protogen.Plugin, file *protogen.File) *protogen.Generated
genFile.Id("const _ =").Qual("google.golang.org/grpc", "SupportPackageIsVersion7")

g.Skip()
forEachMessage(nil, file.Messages, func(parent *protogen.Message, child *protogen.Message) {
forEachMessage(nil, file.Messages, func(parent, child *protogen.Message) {
if child.Desc.IsMapEntry() {
return
}
Expand Down Expand Up @@ -88,7 +88,7 @@ func protocVersion(gen *protogen.Plugin) string {
return fmt.Sprintf("v%d.%d.%d%s", v.GetMajor(), v.GetMinor(), v.GetPatch(), suffix)
}

func forEachMessage(parent *protogen.Message, children []*protogen.Message, f func(parent *protogen.Message, child *protogen.Message)) {
func forEachMessage(parent *protogen.Message, children []*protogen.Message, f func(parent, child *protogen.Message)) {
for _, child := range children {
f(parent, child)
forEachMessage(child, child.Messages, f)
Expand Down
6 changes: 3 additions & 3 deletions cryptoutil/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func removePadding(token string) string {
return strings.TrimRight(token, "=")
}

func AesCBCEncrypt(orig string, key string) result.Result[string] {
func AesCBCEncrypt(orig, key string) result.Result[string] {
var val result.Result[string]

// 转成字节数组
Expand All @@ -70,7 +70,7 @@ func AesCBCEncrypt(orig string, key string) result.Result[string] {
return val.WithVal(base64.StdEncoding.EncodeToString(cryted))
}

func AesCBCDecrypt(cryted string, key string) result.Result[string] {
func AesCBCDecrypt(cryted, key string) result.Result[string] {
var val result.Result[string]

// 转成字节数组
Expand Down Expand Up @@ -132,7 +132,7 @@ func HashPassword(password string) result.Result[string] {
}

// CheckPassword checks to see if the password matches the hashed password.
func CheckPassword(hash string, password string) error {
func CheckPassword(hash, password string) error {
return bcrypt.CompareHashAndPassword([]byte(hash), []byte(password))
}

Expand Down
6 changes: 3 additions & 3 deletions funk.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,21 @@ func Last[T any](args []T) (t T) {
return args[len(args)-1]
}

func Ternary[T any](ok bool, a T, b T) T {
func Ternary[T any](ok bool, a, b T) T {
if ok {
return a
}
return b
}

func TernaryFn[T any](ok bool, a func() T, b func() T) T {
func TernaryFn[T any](ok bool, a, b func() T) T {
if ok {
return a()
}
return b()
}

func Map[T any, V any](data []T, handle func(T) V) []V {
func Map[T, V any](data []T, handle func(T) V) []V {
vv := make([]V, 0, len(data))
for i := range data {
vv = append(vv, handle(data[i]))
Expand Down
6 changes: 3 additions & 3 deletions generic/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,21 @@ func Last[T any](args []T) (t T) {
return args[len(args)-1]
}

func Ternary[T any](ok bool, a T, b T) T {
func Ternary[T any](ok bool, a, b T) T {
if ok {
return a
}
return b
}

func TernaryFn[T any](ok bool, a func() T, b func() T) T {
func TernaryFn[T any](ok bool, a, b func() T) T {
if ok {
return a()
}
return b()
}

func Map[T any, V any](data []T, handle func(i int) V) []V {
func Map[T, V any](data []T, handle func(i int) V) []V {
vv := make([]V, 0, len(data))
for i := range data {
vv = append(vv, handle(i))
Expand Down
16 changes: 8 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/dustin/go-humanize v1.0.0
github.com/flosch/pongo2/v6 v6.0.0
github.com/goccy/go-json v0.10.0
github.com/golang/protobuf v1.5.2
github.com/golang/protobuf v1.5.4
github.com/gopherjs/gopherjs v1.17.2
github.com/hashicorp/go-version v1.6.0
github.com/huandu/go-clone v1.5.1
Expand All @@ -33,12 +33,12 @@ require (
go.etcd.io/bbolt v1.3.7
go.etcd.io/etcd/client/v3 v3.5.9
go.uber.org/atomic v1.10.0
golang.org/x/crypto v0.4.0
golang.org/x/crypto v0.21.0
golang.org/x/exp v0.0.0-20221114191408-850992195362
golang.org/x/sys v0.6.0
golang.org/x/sys v0.18.0
google.golang.org/genproto v0.0.0-20221027153422-115e99e71e1c
google.golang.org/grpc v1.51.0
google.golang.org/protobuf v1.28.1
google.golang.org/protobuf v1.33.0
gopkg.in/yaml.v3 v3.0.1
modernc.org/sqlite v1.18.0
)
Expand All @@ -61,10 +61,10 @@ require (
go.etcd.io/etcd/client/pkg/v3 v3.5.9 // indirect
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.17.0 // indirect
golang.org/x/mod v0.6.0 // indirect
golang.org/x/net v0.4.0 // indirect
golang.org/x/text v0.5.0 // indirect
golang.org/x/tools v0.2.0 // indirect
golang.org/x/mod v0.8.0 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/tools v0.6.0 // indirect
lukechampine.com/uint128 v1.1.1 // indirect
modernc.org/cc/v3 v3.36.0 // indirect
modernc.org/ccgo/v3 v3.16.6 // indirect
Expand Down
37 changes: 17 additions & 20 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,9 @@ github.com/goccy/go-json v0.10.0/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MG
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
Expand Down Expand Up @@ -133,23 +131,24 @@ go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.4.0 h1:UVQgzMY87xqpKNgb+kDsll2Igd33HszWHFLmpaRMq/8=
golang.org/x/crypto v0.4.0/go.mod h1:3quD/ATkf6oY+rnes5c3ExXTbLc8mueNue5/DoinL80=
golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA=
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
golang.org/x/exp v0.0.0-20221114191408-850992195362 h1:NoHlPRbyl1VFI6FjwHtPQCN7wAMXI6cKcqrmXhOOfBQ=
golang.org/x/exp v0.0.0-20221114191408-850992195362/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.6.0 h1:b9gGHsz9/HhJ3HF5DHQytPpuwocVTChQJK3AvoLRD5I=
golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI=
golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.4.0 h1:Q5QPcMlvfxFTAPV0+07Xz/MpK9NTXu2VDUuy0FeMfaU=
golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE=
golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4=
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
Expand All @@ -158,19 +157,19 @@ golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.5.0 h1:OLmvp0KP+FVG99Ct/qFiL/Fhk4zp4QQnZ7b2U+5piUM=
golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20201124115921-2c860bdd6e78/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.2.0 h1:G6AHpWxTMGY1KyEYoAQ5WTtIekUUvDNjan3ugu60JvE=
golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA=
golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand All @@ -179,10 +178,8 @@ google.golang.org/genproto v0.0.0-20221027153422-115e99e71e1c h1:QgY/XxIAIeccR+C
google.golang.org/genproto v0.0.0-20221027153422-115e99e71e1c/go.mod h1:CGI5F/G+E5bKwmfYo09AXuVN4dD894kIKUFmVbP2/Fo=
google.golang.org/grpc v1.51.0 h1:E1eGv1FTqoLIdnBCZufiSHgKjlqG6fKFf6pPWtMTh8U=
google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w=
google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
Expand Down
6 changes: 3 additions & 3 deletions merge/merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type Option func(opts *copier.Option)
// Copy
// struct<->struct
// 各种类型结构体之间的field copy
func Copy[A any, B any](dst *A, src *B, opts ...Option) result.Result[*A] {
func Copy[A, B any](dst *A, src *B, opts ...Option) result.Result[*A] {
opt := copier.Option{DeepCopy: true, IgnoreEmpty: true}
for i := range opts {
opts[i](&opt)
Expand All @@ -35,14 +35,14 @@ func Copy[A any, B any](dst *A, src *B, opts ...Option) result.Result[*A] {
return result.OK(dst)
}

func Struct[A any, B any](dst *A, src *B, opts ...Option) result.Result[*A] {
func Struct[A, B any](dst *A, src *B, opts ...Option) result.Result[*A] {
return Copy(dst, src, opts...)
}

// MapStruct
// map<->struct
// map和结构体相互转化
func MapStruct[A any, B any](dst A, src B, opts ...func(cfg *mapstructure.DecoderConfig)) (r result.Result[A]) {
func MapStruct[A, B any](dst A, src B, opts ...func(cfg *mapstructure.DecoderConfig)) (r result.Result[A]) {
cfg := &mapstructure.DecoderConfig{
TagName: "json",
Metadata: nil,
Expand Down
4 changes: 2 additions & 2 deletions netutil/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func GetLocalIP() string {
}

// IsPortUsed 检查端口是否被占用
func IsPortUsed(protocol string, addr string) bool {
func IsPortUsed(protocol, addr string) bool {
conn, err := net.DialTimeout(protocol, addr, 3*time.Second)
if err != nil {
return false
Expand All @@ -50,7 +50,7 @@ func IsPortUsed(protocol string, addr string) bool {
}

// DiscoverDNS ...
func DiscoverDNS(service, proto string, address string) ([]*net.SRV, error) {
func DiscoverDNS(service, proto, address string) ([]*net.SRV, error) {
_, addresses, err := net.LookupSRV(service, proto, address)
if err != nil {
return nil, err
Expand Down
6 changes: 3 additions & 3 deletions pathutil/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func IsDir(path string) bool {
}

// CopyFile copies the source file to the dest file.
func CopyFile(source string, dest string) (err error) {
func CopyFile(source, dest string) (err error) {
defer recovery.Err(&err)

sourcefile := assert.Must1(os.Open(source))
Expand All @@ -82,7 +82,7 @@ func CopyFile(source string, dest string) (err error) {
}

// CopyDir copies the source directory to the dest directory.
func CopyDir(source string, dest string) (err error) {
func CopyDir(source, dest string) (err error) {
defer recovery.Err(&err)

sourceinfo := assert.Must1(os.Stat(source))
Expand Down Expand Up @@ -111,7 +111,7 @@ func CopyDir(source string, dest string) (err error) {
// GrepFile like command grep -E
// for example: GrepFile(`^hello`, "hello.txt")
// \n is striped while read
func GrepFile(patten string, filename string) (lines []string, err error) {
func GrepFile(patten, filename string) (lines []string, err error) {
re, err := regexp.Compile(patten)
if err != nil {
return
Expand Down
4 changes: 2 additions & 2 deletions protoutil/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ func CamelCase(s string) string {
// - method is POST
// - path is "<pkg name>/<service name>/<method name>"
// - body should contain the serialized request message
func DefaultAPIOptions(pkg string, srv string, mth string) *options.HttpRule {
func DefaultAPIOptions(pkg, srv, mth string) *options.HttpRule {
return &options.HttpRule{
Pattern: &options.HttpRule_Post{
Post: "/" + camel2Case(fmt.Sprintf("%s/%s/%s", camel2Case(pkg), camel2Case(srv), camel2Case(mth))),
Expand Down Expand Up @@ -216,7 +216,7 @@ func ExtractAPIOptions(mth *descriptor.MethodDescriptorProto) (*options.HttpRule
return opts, nil
}

func ExtractHttpMethod(opts *options.HttpRule) (method string, path string) {
func ExtractHttpMethod(opts *options.HttpRule) (method, path string) {
var (
httpMethod string
pathTemplate string
Expand Down
2 changes: 1 addition & 1 deletion tlsutil/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

// generateCert generates a temporary certificate for plugin authentication. The
// certificate and private key are returns in PEM format.
func generateCert() (cert []byte, privateKey []byte, err error) {
func generateCert() (cert, privateKey []byte, err error) {
key, err := ecdsa.GenerateKey(elliptic.P521(), rand.Reader)
if err != nil {
return nil, nil, err
Expand Down

0 comments on commit 20a76da

Please sign in to comment.