Skip to content

Commit cdad04e

Browse files
committed
feat: update examples.
1 parent 3fc245a commit cdad04e

File tree

22 files changed

+318
-298
lines changed

22 files changed

+318
-298
lines changed

.github/main.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ func (m *GoOrb) Lint(
141141
Sharing: dagger.CacheSharingMode("SHARED"),
142142
},
143143
).
144+
WithEnvVariable("GOPROXY", "direct").
145+
WithEnvVariable("GOSUMDB", "off").
144146
WithMountedCache("/root/.cache/golangci-lint", dag.CacheVolume("golangci-lint")).
145147
WithDirectory("/work/src", root.Directory(dir)).
146148
WithWorkdir("/work/src").
@@ -171,6 +173,8 @@ func (m *GoOrb) goContainer(root *dagger.Directory, dir string) *dagger.Containe
171173
Sharing: dagger.CacheSharingMode("SHARED"),
172174
},
173175
).
176+
WithEnvVariable("GOPROXY", "direct").
177+
WithEnvVariable("GOSUMDB", "off").
174178
WithDirectory("/work/src", root.Directory(dir)).
175179
WithWorkdir("/work/src")
176180
}
@@ -256,8 +260,6 @@ func (m *GoOrb) Update(ctx context.Context, root *dagger.Directory) (*AllResult,
256260
}
257261

258262
c := m.goContainer(root, dir).
259-
WithEnvVariable("GOPROXY", "direct").
260-
WithEnvVariable("GOSUMDB", "off").
261263
WithExec([]string{"go", "get", "-u", "-t", "./..."}).
262264
WithExec([]string{"go", "get", "-u", "github.com/go-orb/go-orb@latest"}).
263265
WithExec([]string{"bash", "-c", "for m in $(grep github.com/go-orb/plugins go.mod | grep -E -v \"^module\" | awk '{ print $1 }'); do go get -u \"${m}@latest\"; done"}).

benchmarks/event/go.mod

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ module github.com/go-orb/examples/benchmarks/event
33
go 1.23.6
44

55
require (
6-
github.com/go-orb/go-orb v0.2.2-0.20250311013353-9996c5ae2659
7-
github.com/go-orb/plugins/cli/urfave v0.0.0-20250311025432-c3f6c11bc7a0
8-
github.com/go-orb/plugins/codecs/goccyjson v0.1.1-0.20250311025432-c3f6c11bc7a0
9-
github.com/go-orb/plugins/codecs/json v0.1.1-0.20250311025432-c3f6c11bc7a0
10-
github.com/go-orb/plugins/codecs/proto v0.1.1-0.20250311025432-c3f6c11bc7a0
11-
github.com/go-orb/plugins/event/natsjs v0.1.1-0.20250311025432-c3f6c11bc7a0
12-
github.com/go-orb/plugins/log/slog v0.1.1-0.20250311025432-c3f6c11bc7a0
6+
github.com/go-orb/go-orb v0.2.2-0.20250311024506-e44d2eb21aa9
7+
github.com/go-orb/plugins/cli/urfave v0.0.0-20250311055558-8297a94ff1c7
8+
github.com/go-orb/plugins/codecs/goccyjson v0.1.1-0.20250311055558-8297a94ff1c7
9+
github.com/go-orb/plugins/codecs/json v0.1.1-0.20250311055558-8297a94ff1c7
10+
github.com/go-orb/plugins/codecs/proto v0.1.1-0.20250311055558-8297a94ff1c7
11+
github.com/go-orb/plugins/event/natsjs v0.1.1-0.20250311055558-8297a94ff1c7
12+
github.com/go-orb/plugins/log/slog v0.1.1-0.20250311055558-8297a94ff1c7
1313
github.com/go-orb/wire v0.7.0
1414
google.golang.org/protobuf v1.36.5
1515
)

benchmarks/event/go.sum

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@ github.com/cpuguy83/go-md2man/v2 v2.0.6 h1:XJtiaUW6dEEqVuZiMTn1ldk455QWwEIsMIJlo
44
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
55
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
66
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
7-
github.com/go-orb/go-orb v0.2.2-0.20250311013353-9996c5ae2659 h1:lgx4A5R5TKPrAKbg1v+XID/lL7ZgSXa3B20awh4yfI4=
8-
github.com/go-orb/go-orb v0.2.2-0.20250311013353-9996c5ae2659/go.mod h1:UgBB26ldvzHNjg6721K2o5DEM6qX44ZHqCW0SanoAFA=
9-
github.com/go-orb/plugins/cli/urfave v0.0.0-20250311025432-c3f6c11bc7a0 h1:auiIrfEVAochvBUqfxxJGS9rW0JErmGcy52ca6StW4k=
10-
github.com/go-orb/plugins/cli/urfave v0.0.0-20250311025432-c3f6c11bc7a0/go.mod h1:Yvfr2ylrseKWmn4cqLgWdv/cSt6Nsf5VCVS+XXWHva0=
11-
github.com/go-orb/plugins/codecs/goccyjson v0.1.1-0.20250311025432-c3f6c11bc7a0 h1:PGrTGgF/+W83zuTisJaq4FCx7id1VVYTopAKQFz1ATM=
12-
github.com/go-orb/plugins/codecs/goccyjson v0.1.1-0.20250311025432-c3f6c11bc7a0/go.mod h1:hrbbOHGv47dE0PWchJ1OAc9sEPZ6GcnJcPkB4fYgQ1E=
13-
github.com/go-orb/plugins/codecs/json v0.1.1-0.20250311025432-c3f6c11bc7a0 h1:IX5kvi6quJptaZ4gp2otPkzGWARPP/maGAmik3uXN6A=
14-
github.com/go-orb/plugins/codecs/json v0.1.1-0.20250311025432-c3f6c11bc7a0/go.mod h1:TY3dhUGx+cYbV8cUehQhmS0JOrBpCAc3Cc2VHncjLkE=
15-
github.com/go-orb/plugins/codecs/proto v0.1.1-0.20250311025432-c3f6c11bc7a0 h1:veQZltWsUJn3X9ICcGcYPOGwxG/6muNTo8fxJYiv2tQ=
16-
github.com/go-orb/plugins/codecs/proto v0.1.1-0.20250311025432-c3f6c11bc7a0/go.mod h1:O/JU+k2HGC/oCG5iA1WFcPgqIX497H1WEaAtluUiD0Q=
17-
github.com/go-orb/plugins/event/natsjs v0.1.1-0.20250311025432-c3f6c11bc7a0 h1:iAXxeTXcvVxGbbLI4/2144V8VHxiz2RG44mSEgg2ack=
18-
github.com/go-orb/plugins/event/natsjs v0.1.1-0.20250311025432-c3f6c11bc7a0/go.mod h1:2R5wT5QYDlUTCjCgfyZsC+FWpJ6RR8LFH/afqGhgYV8=
19-
github.com/go-orb/plugins/log/slog v0.1.1-0.20250311025432-c3f6c11bc7a0 h1:6q7S9LhbMdXqnduO1Dr6DHz4E0uuKBGOAey/X4Xdvn8=
20-
github.com/go-orb/plugins/log/slog v0.1.1-0.20250311025432-c3f6c11bc7a0/go.mod h1:C76zIgyBuHXnMLjQgFMQFDftekPUQ0DnbeRNnOnIwx0=
7+
github.com/go-orb/go-orb v0.2.2-0.20250311024506-e44d2eb21aa9 h1:78EZ6KJ/NYHGKTJqYDxDLVIXSIXtBb8akhVNQ8DJ3z4=
8+
github.com/go-orb/go-orb v0.2.2-0.20250311024506-e44d2eb21aa9/go.mod h1:UgBB26ldvzHNjg6721K2o5DEM6qX44ZHqCW0SanoAFA=
9+
github.com/go-orb/plugins/cli/urfave v0.0.0-20250311055558-8297a94ff1c7 h1:CrWPUPAZkQTk/+5w9inUy0tPpM2BAYfRjhlBv7TloIY=
10+
github.com/go-orb/plugins/cli/urfave v0.0.0-20250311055558-8297a94ff1c7/go.mod h1:Yvfr2ylrseKWmn4cqLgWdv/cSt6Nsf5VCVS+XXWHva0=
11+
github.com/go-orb/plugins/codecs/goccyjson v0.1.1-0.20250311055558-8297a94ff1c7 h1:kinJztL37ApwAS2d4E8gcthk9UGs2tjminxMxGj4SNw=
12+
github.com/go-orb/plugins/codecs/goccyjson v0.1.1-0.20250311055558-8297a94ff1c7/go.mod h1:hrbbOHGv47dE0PWchJ1OAc9sEPZ6GcnJcPkB4fYgQ1E=
13+
github.com/go-orb/plugins/codecs/json v0.1.1-0.20250311055558-8297a94ff1c7 h1:lmuTCqBkKpetbkut1AvO2UgS1EPZZRbAamLXHnzDuzI=
14+
github.com/go-orb/plugins/codecs/json v0.1.1-0.20250311055558-8297a94ff1c7/go.mod h1:TY3dhUGx+cYbV8cUehQhmS0JOrBpCAc3Cc2VHncjLkE=
15+
github.com/go-orb/plugins/codecs/proto v0.1.1-0.20250311055558-8297a94ff1c7 h1:0xmlOab5j5ybO+XrKUzRl58GfbTmzkg7Hy2QyCxU7Ow=
16+
github.com/go-orb/plugins/codecs/proto v0.1.1-0.20250311055558-8297a94ff1c7/go.mod h1:O/JU+k2HGC/oCG5iA1WFcPgqIX497H1WEaAtluUiD0Q=
17+
github.com/go-orb/plugins/event/natsjs v0.1.1-0.20250311055558-8297a94ff1c7 h1:zkRVUQ84eKahQFmeiNwfRMIVQYZtSBYlAWPgyPlzKPw=
18+
github.com/go-orb/plugins/event/natsjs v0.1.1-0.20250311055558-8297a94ff1c7/go.mod h1:2R5wT5QYDlUTCjCgfyZsC+FWpJ6RR8LFH/afqGhgYV8=
19+
github.com/go-orb/plugins/log/slog v0.1.1-0.20250311055558-8297a94ff1c7 h1:Uc2mNXjClHfGiMxsCaIlPlcHxekhlBk8kiYJ9xAR8Uw=
20+
github.com/go-orb/plugins/log/slog v0.1.1-0.20250311055558-8297a94ff1c7/go.mod h1:C76zIgyBuHXnMLjQgFMQFDftekPUQ0DnbeRNnOnIwx0=
2121
github.com/go-orb/wire v0.7.0 h1:P9S100bM8nhAgW6e7EJrbi5vzNXCsP/Q1ByIEV5+hUQ=
2222
github.com/go-orb/wire v0.7.0/go.mod h1:/ID7hS6X2F32YnuRgh+k8R/sjucoh4qciqe7dq2dY7g=
2323
github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4=

benchmarks/rps/cmd/orb-rps-client/main.go

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020

2121
echoproto "github.com/go-orb/examples/benchmarks/rps/proto/echo"
2222

23-
// Import required plugins
23+
// Import required plugins.
2424
_ "github.com/go-orb/plugins-experimental/registry/mdns"
2525
_ "github.com/go-orb/plugins/client/orb"
2626
_ "github.com/go-orb/plugins/codecs/goccyjson"
@@ -29,7 +29,7 @@ import (
2929
_ "github.com/go-orb/plugins/log/slog"
3030
_ "github.com/go-orb/plugins/registry/consul"
3131

32-
// Transport plugins
32+
// Transport plugins.
3333
_ "github.com/go-orb/plugins/client/orb_transport/drpc"
3434
_ "github.com/go-orb/plugins/client/orb_transport/grpc"
3535
_ "github.com/go-orb/plugins/client/orb_transport/h2c"
@@ -134,9 +134,15 @@ func setupClientOptions(ctx context.Context, cfg *clientConfig, cli client.Type,
134134
}
135135

136136
// runBenchmark executes the benchmark with the given configuration.
137-
func runBenchmark(ctx context.Context, duration int, connections int, cli client.Type, logger log.Logger,
138-
msg []byte, opts []client.CallOption) (uint64, uint64) {
139-
137+
func runBenchmark(
138+
ctx context.Context,
139+
duration int,
140+
connections int,
141+
cli client.Type,
142+
logger log.Logger,
143+
msg []byte,
144+
opts []client.CallOption,
145+
) (uint64, uint64) {
140146
var wg sync.WaitGroup
141147

142148
stats := &benchStats{}
@@ -192,7 +198,7 @@ func bench(ctx context.Context, cfg *clientConfig, logger log.Logger, cli client
192198

193199
// Run warmup phase
194200
logger.Info("Warming up...")
195-
warmupOk, warmupErr := runBenchmark(ctx, 1, cfg.Connections, cli, logger, msg, opts)
201+
warmupOk, warmupErr := runBenchmark(ctx, 5, cfg.Connections, cli, logger, msg, opts)
196202
logger.Debug("Warmup complete", "requests_ok", warmupOk, "requests_error", warmupErr)
197203

198204
// Run benchmark phase

benchmarks/rps/cmd/orb-rps-client/wire_gen.go

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

benchmarks/rps/cmd/orb-rps-server/main.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import (
1616
_ "github.com/go-orb/plugins/log/lumberjack"
1717
_ "github.com/go-orb/plugins/log/slog"
1818
_ "github.com/go-orb/plugins/registry/consul"
19-
_ "github.com/go-orb/plugins/server/http/router/chi"
2019
)
2120

2221
func main() {

benchmarks/rps/cmd/orb-rps-server/wire_gen.go

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

benchmarks/rps/go.mod

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,28 @@ module github.com/go-orb/examples/benchmarks/rps
33
go 1.23.6
44

55
require (
6-
github.com/go-orb/go-orb v0.2.2-0.20250311013353-9996c5ae2659
7-
github.com/go-orb/plugins-experimental/registry/mdns v0.0.0-20250310151257-e3753cc29dd6
8-
github.com/go-orb/plugins/cli/urfave v0.0.0-20250311025432-c3f6c11bc7a0
9-
github.com/go-orb/plugins/client/orb v0.1.4-0.20250311025432-c3f6c11bc7a0
10-
github.com/go-orb/plugins/client/orb_transport/drpc v0.0.0-20250311025432-c3f6c11bc7a0
11-
github.com/go-orb/plugins/client/orb_transport/grpc v0.0.0-20250311025432-c3f6c11bc7a0
12-
github.com/go-orb/plugins/client/orb_transport/h2c v0.0.0-20250311025432-c3f6c11bc7a0
13-
github.com/go-orb/plugins/client/orb_transport/http v0.0.0-20250311025432-c3f6c11bc7a0
14-
github.com/go-orb/plugins/client/orb_transport/http3 v0.0.0-20250311025432-c3f6c11bc7a0
15-
github.com/go-orb/plugins/client/orb_transport/https v0.0.0-20250311025432-c3f6c11bc7a0
16-
github.com/go-orb/plugins/codecs/goccyjson v0.1.1-0.20250311025432-c3f6c11bc7a0
17-
github.com/go-orb/plugins/codecs/json v0.1.1-0.20250311025432-c3f6c11bc7a0
18-
github.com/go-orb/plugins/codecs/proto v0.1.1-0.20250311025432-c3f6c11bc7a0
19-
github.com/go-orb/plugins/codecs/yaml v0.1.1-0.20250311025432-c3f6c11bc7a0
20-
github.com/go-orb/plugins/config/source/file v0.1.1-0.20250311025432-c3f6c11bc7a0
21-
github.com/go-orb/plugins/log/lumberjack v0.1.1-0.20250311025432-c3f6c11bc7a0
22-
github.com/go-orb/plugins/log/slog v0.1.1-0.20250311025432-c3f6c11bc7a0
23-
github.com/go-orb/plugins/registry/consul v0.1.1-0.20250311025432-c3f6c11bc7a0
24-
github.com/go-orb/plugins/server/drpc v0.1.1-0.20250311025432-c3f6c11bc7a0
25-
github.com/go-orb/plugins/server/grpc v0.1.1-0.20250311025432-c3f6c11bc7a0
26-
github.com/go-orb/plugins/server/http v0.1.1-0.20250311025432-c3f6c11bc7a0
27-
github.com/go-orb/plugins/server/memory v0.0.0-20250311025432-c3f6c11bc7a0
6+
github.com/go-orb/go-orb v0.2.2-0.20250311024506-e44d2eb21aa9
7+
github.com/go-orb/plugins-experimental/registry/mdns v0.0.0-20250311030251-33347369bbe1
8+
github.com/go-orb/plugins/cli/urfave v0.0.0-20250311055558-8297a94ff1c7
9+
github.com/go-orb/plugins/client/orb v0.1.4-0.20250311055558-8297a94ff1c7
10+
github.com/go-orb/plugins/client/orb_transport/drpc v0.0.0-20250311055558-8297a94ff1c7
11+
github.com/go-orb/plugins/client/orb_transport/grpc v0.0.0-20250311055558-8297a94ff1c7
12+
github.com/go-orb/plugins/client/orb_transport/h2c v0.0.0-20250311055558-8297a94ff1c7
13+
github.com/go-orb/plugins/client/orb_transport/http v0.0.0-20250311055558-8297a94ff1c7
14+
github.com/go-orb/plugins/client/orb_transport/http3 v0.0.0-20250311055558-8297a94ff1c7
15+
github.com/go-orb/plugins/client/orb_transport/https v0.0.0-20250311055558-8297a94ff1c7
16+
github.com/go-orb/plugins/codecs/goccyjson v0.1.1-0.20250311055558-8297a94ff1c7
17+
github.com/go-orb/plugins/codecs/json v0.1.1-0.20250311055558-8297a94ff1c7
18+
github.com/go-orb/plugins/codecs/proto v0.1.1-0.20250311055558-8297a94ff1c7
19+
github.com/go-orb/plugins/codecs/yaml v0.1.1-0.20250311055558-8297a94ff1c7
20+
github.com/go-orb/plugins/config/source/file v0.1.1-0.20250311055558-8297a94ff1c7
21+
github.com/go-orb/plugins/log/lumberjack v0.1.1-0.20250311055558-8297a94ff1c7
22+
github.com/go-orb/plugins/log/slog v0.1.1-0.20250311055558-8297a94ff1c7
23+
github.com/go-orb/plugins/registry/consul v0.1.1-0.20250311055558-8297a94ff1c7
24+
github.com/go-orb/plugins/server/drpc v0.1.1-0.20250311055558-8297a94ff1c7
25+
github.com/go-orb/plugins/server/grpc v0.1.1-0.20250311055558-8297a94ff1c7
26+
github.com/go-orb/plugins/server/http v0.1.1-0.20250311055558-8297a94ff1c7
27+
github.com/go-orb/plugins/server/memory v0.0.0-20250311055558-8297a94ff1c7
2828
github.com/go-orb/wire v0.7.0
2929
google.golang.org/grpc v1.71.0
3030
google.golang.org/protobuf v1.36.5
@@ -36,9 +36,8 @@ require (
3636
github.com/cornelk/hashmap v1.0.8 // indirect
3737
github.com/cpuguy83/go-md2man/v2 v2.0.6 // indirect
3838
github.com/fatih/color v1.18.0 // indirect
39-
github.com/go-chi/chi/v5 v5.2.1 // indirect
40-
github.com/go-orb/plugins/client/orb_transport/basehttp v0.0.0-20250311025432-c3f6c11bc7a0 // indirect
41-
github.com/go-orb/plugins/registry/regutil v0.1.1-0.20250311025432-c3f6c11bc7a0 // indirect
39+
github.com/go-orb/plugins/client/orb_transport/basehttp v0.0.0-20250311055558-8297a94ff1c7 // indirect
40+
github.com/go-orb/plugins/registry/regutil v0.1.1-0.20250311055558-8297a94ff1c7 // indirect
4241
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
4342
github.com/goccy/go-json v0.10.5 // indirect
4443
github.com/google/pprof v0.0.0-20250302191652-9094ed2288e7 // indirect
@@ -53,6 +52,7 @@ require (
5352
github.com/hashicorp/go-rootcerts v1.0.2 // indirect
5453
github.com/hashicorp/golang-lru v1.0.2 // indirect
5554
github.com/hashicorp/serf v0.10.2 // indirect
55+
github.com/julienschmidt/httprouter v1.3.0 // indirect
5656
github.com/mattn/go-colorable v0.1.14 // indirect
5757
github.com/mattn/go-isatty v0.0.20 // indirect
5858
github.com/miekg/dns v1.1.63 // indirect

0 commit comments

Comments
 (0)