MCPcopy Index your code
hub / github.com/oapi-codegen/oapi-codegen / Run

Method Run

examples/streaming/stdhttp/sse/impl.go:28–45  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

26 return s
27}
28func (s Server) Run(ctx context.Context) error {
29 go func() {
30 <-ctx.Done()
31 slog.Warn("context cancelled, shutting down")
32 ctxTimeout, cancel := context.WithTimeout(context.Background(), 5*time.Second)
33 err := s.httpServer.Shutdown(ctxTimeout)
34 cancel()
35 if err != nil {
36 slog.Error("httpServer.Shutdown() error", "error", err)
37 }
38 }()
39
40 err := s.httpServer.ListenAndServe()
41 if err != nil && !errors.Is(err, http.ErrServerClosed) {
42 return fmt.Errorf("httpServer.ListenAndServe() error: %w", err)
43 }
44 return nil
45}
46
47type SObject struct {
48 Time time.Time `json:"time"`

Callers 15

mainFunction · 0.95
TestFindReferencesFunction · 0.80
TestToCamelCaseFunction · 0.80
TestRefPathToGoTypeFunction · 0.80
TestSortParamsByPathFunction · 0.80
TestStringToGoCommentFunction · 0.80

Calls 1

ErrorMethod · 0.45

Tested by 15

TestFindReferencesFunction · 0.64
TestToCamelCaseFunction · 0.64
TestRefPathToGoTypeFunction · 0.64
TestSortParamsByPathFunction · 0.64
TestStringToGoCommentFunction · 0.64
Test_replaceInitialismFunction · 0.64