goadesign / goa

🌟 Goa: Elevate Go API development! 🚀 Streamlined design, automatic code generation, and seamless HTTP/gRPC support. ✨
https://goa.design
MIT License
5.68k stars 559 forks source link

Deprecated Code in Generated http.go using goa example #3448

Closed gobijan closed 4 months ago

gobijan commented 9 months ago

Description: When generating the http.go file using the goa example command, the generated code includes a deprecated function httpmdlwr.RequestID. This leads to the following deprecation warning:

httpmdlwr.RequestID is deprecated: use OpenTelemetry instead, see for example github.com/goadesign/clue. This function will be removed in a future version of Goa.deprecated(default)

Problematic Code:

// Wrap the multiplexer with additional middlewares. Middlewares mounted
// here apply to all the service endpoints.
var handler http.Handler = mux
{
    handler = httpmdlwr.Log(adapter)(handler)
    handler = httpmdlwr.RequestID()(handler)
}

Suggested Fix: It would be beneficial for the default example generation to utilize the clue package in place of the deprecated httpmdlwr.RequestID function. This aligns with current best practices and avoids the introduction of deprecated code in new projects.

Impact: This issue impacts new users or projects using Goa, as it introduces deprecated code right from the start, potentially leading to future compatibility issues.