Skip to content

Commit eb05695

Browse files
committed
use firstWordToLower, and readd ErrorWithCause deprecated method
1 parent 3e4d6f1 commit eb05695

File tree

7 files changed

+18
-11
lines changed

7 files changed

+18
-11
lines changed

_examples/golang-basics/go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module golang-basics
22

33
go 1.23.12
44

5-
// replace github.com/webrpc/webrpc => ../webrpc
5+
// replace github.com/webrpc/webrpc => ../../../webrpc
66

77
toolchain go1.24.0
88

@@ -53,11 +53,11 @@ require (
5353
github.com/spf13/cast v1.10.0 // indirect
5454
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
5555
github.com/webrpc/gen-dart v0.1.1 // indirect
56-
github.com/webrpc/gen-golang v0.21.0 // indirect
56+
github.com/webrpc/gen-golang v0.22.1 // indirect
5757
github.com/webrpc/gen-javascript v0.13.0 // indirect
5858
github.com/webrpc/gen-kotlin v0.1.0 // indirect
5959
github.com/webrpc/gen-openapi v0.16.3 // indirect
60-
github.com/webrpc/gen-typescript v0.19.0 // indirect
60+
github.com/webrpc/gen-typescript v0.20.2 // indirect
6161
github.com/webrpc/webrpc v0.28.2 // indirect
6262
github.com/xanzy/ssh-agent v0.3.3 // indirect
6363
golang.org/x/arch v0.1.0 // indirect

_examples/golang-basics/go.sum

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -224,18 +224,16 @@ github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS
224224
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
225225
github.com/webrpc/gen-dart v0.1.1 h1:PZh5oNNdA84Qxu8ixKDf1cT8Iv6t0g7x6q9aeX1bti4=
226226
github.com/webrpc/gen-dart v0.1.1/go.mod h1:yq0ThW3ANNulJLyR50jx1aZMEVBDp19VUHucK65ayPs=
227-
github.com/webrpc/gen-golang v0.21.0 h1:eQuv7x7nZQfT9zFyAOE6d2dc2zT+znOlelsy8LnGRn0=
228-
github.com/webrpc/gen-golang v0.21.0/go.mod h1:t8tIVL/AQhaMteA31xNbzWUrumiMXc7OcKmnNALpnAM=
227+
github.com/webrpc/gen-golang v0.22.1 h1:qWOdXH/3X9A+ElVPBcdDrjzWxpf8LdoI2nnjxJSax2E=
228+
github.com/webrpc/gen-golang v0.22.1/go.mod h1:t8tIVL/AQhaMteA31xNbzWUrumiMXc7OcKmnNALpnAM=
229229
github.com/webrpc/gen-javascript v0.13.0 h1:tw7U1xueUjZz3cQAAA4/DZ90BHydkQKiJC4VXd/j2hg=
230230
github.com/webrpc/gen-javascript v0.13.0/go.mod h1:5EhapSJgzbiWrIGlqzZN9Lg9mE9209wwX+Du2dgn4EU=
231231
github.com/webrpc/gen-kotlin v0.1.0 h1:tnlinqbDgowEoSy8E3VovTdP2OjyOIbgACCbahRjNcc=
232232
github.com/webrpc/gen-kotlin v0.1.0/go.mod h1:PIPys9Gn1Ro7q7uoacydEX8CtqBlAJSV98A++tdj4ak=
233233
github.com/webrpc/gen-openapi v0.16.3 h1:Gwj1Wxdqu+jLsVd+JeUuvf92JyLTZ/nMNcSwVpdqEWs=
234234
github.com/webrpc/gen-openapi v0.16.3/go.mod h1:fwY3ylZmdiCr+WXjR8Ek8wm08CFRr2/GaXI7Zd/Ou4Y=
235-
github.com/webrpc/gen-typescript v0.19.0 h1:apV8DsHAVzyOG4i45I93/YQeDXsy/fBPqFSV6CjWSWM=
236-
github.com/webrpc/gen-typescript v0.19.0/go.mod h1:xQzYnVaSMfcygDXA5SuW8eYyCLHBHkj15wCF7gcJF5Y=
237-
github.com/webrpc/webrpc v0.28.2 h1:bZ9TynaCGN78qvVhLBdp5b/2VstW1siBx9ZXMQOQiGs=
238-
github.com/webrpc/webrpc v0.28.2/go.mod h1:I9Byizulr4xeAgSdT4TxpWVKxN7qyzkjDITbpMIOEZk=
235+
github.com/webrpc/gen-typescript v0.20.2 h1:FUoraPOQWLL70gSQGYFkuelxUhVSqI7LmmA45CaAbDE=
236+
github.com/webrpc/gen-typescript v0.20.2/go.mod h1:XDW2lL0Ft7Mdf12wcj8STdvuV24k2L/vGY49Ag2M4Lw=
239237
github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM=
240238
github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw=
241239
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=

client.go.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const {{.Name}}PathPrefix = "/rpc/{{.Name}}/"
1616

1717
{{- range $_, $service := $services -}}
1818

19-
{{- $serviceNameClient := (printf "%sClient" ($service.Name | firstLetterToLower)) }}
19+
{{- $serviceNameClient := (printf "%sClient" ($service.Name | firstWordToLower)) }}
2020
{{- $ServiceNameClient := (printf "%sClient" ($service.Name | firstLetterToUpper)) }}
2121
type {{$serviceNameClient}} struct {
2222
client HTTPClient

clientInterface.go.tmpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ type {{$method.Name}}StreamReader interface {
4343
{{ end }}
4444
{{- end }}
4545

46+
{{- "\n" -}}
47+
4648
{{- end -}}
4749
{{- end -}}
4850

errors.go.tmpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ func (e WebRPCError) WithCausef(format string, args ...interface{}) WebRPCError
6464
return err
6565
}
6666

67+
// Deprecated: Use .WithCause() method on WebRPCError.
68+
func ErrorWithCause(rpcErr WebRPCError, cause error) WebRPCError {
69+
return rpcErr.WithCause(cause)
70+
}
71+
6772
{{- if $opts.errorStackTrace }}
6873

6974
func (e WebRPCError) StackFrames() []uintptr {

server.go.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ type WebRPCServer interface {
1616

1717
{{- range $_, $service := $services}}
1818
{{- $name := $service.Name -}}
19-
{{ $serviceName := (printf "%sService" (firstLetterToLower $service.Name)) }}
19+
{{ $serviceName := (printf "%sService" (firstWordToLower $service.Name)) }}
2020

2121
type {{$serviceName}} struct {
2222
{{$typePrefix}}{{$service.Name}}Server

serverInterface.go.tmpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ func (w *{{firstLetterToLower $method.Name}}StreamWriter) Write({{range $i, $out
6969
}
7070

7171
{{ end }}
72+
73+
{{- "\n" -}}
7274
{{- end }}
7375
{{- end }}
7476

0 commit comments

Comments
 (0)