Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/config/super-linter.env
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ VALIDATE_BIOME_LINT=false
VALIDATE_CHECKOV=false
VALIDATE_DOCKERFILE_HADOLINT=false
VALIDATE_GIT_COMMITLINT=false
# times out
VALIDATE_GO_MODULES=false
# golangci-lint (non-module mode) can't handle two Go modules; GO_MODULES covers this
VALIDATE_GO=false
# we have many duplicate code in our codebase for demo purposes
VALIDATE_JSCPD=false
# conflicts with black
Expand All @@ -27,8 +27,8 @@ VALIDATE_TRIVY=false

FIX_CSHARP=true
FIX_ENV=true
FIX_GO=true
FIX_GOOGLE_JAVA_FORMAT=true
FIX_GO_MODULES=true
FIX_JAVASCRIPT_PRETTIER=true
FIX_JSON=true
FIX_JSONC=true
Expand Down
9 changes: 7 additions & 2 deletions examples/go/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,14 @@ func newHTTPHandler() http.Handler {

// handleFunc is a replacement for mux.HandleFunc
// which enriches the handler's HTTP instrumentation with the pattern as the http.route.
//
// NOTE: otelhttp.WithRouteTag is marked deprecated, claiming that http.route is
// automatically extracted from http.Request.Pattern (Go 1.22+). However, as of
// otelhttp v0.64.0 this does not work when otelhttp wraps a ServeMux: the
// http.route attribute is read at span creation time, before the ServeMux has
// routed the request and populated r.Pattern. WithRouteTag is still needed.
handleFunc := func(pattern string, handlerFunc func(http.ResponseWriter, *http.Request)) {
// Configure the "http.route" for the HTTP instrumentation.
handler := otelhttp.WithRouteTag(pattern, http.HandlerFunc(handlerFunc))
handler := otelhttp.WithRouteTag(pattern, http.HandlerFunc(handlerFunc)) //nolint:staticcheck
Comment on lines +71 to +78

Copilot AI Feb 12, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description/summary says otelhttp.WithRouteTag was removed because http.route is auto-extracted in Go 1.22+, but the code still uses otelhttp.WithRouteTag (with //nolint:staticcheck) and even adds a note explaining why it’s still needed. Please reconcile this by either updating the PR description to reflect the actual change, or removing WithRouteTag (and the staticcheck suppression) if it’s no longer required.

Copilot uses AI. Check for mistakes.
mux.Handle(pattern, handler)
}

Expand Down
6 changes: 3 additions & 3 deletions examples/go/otel.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ func setupOTelSDK(ctx context.Context) (shutdown func(context.Context) error, er
// The errors from the calls are joined.
// Each registered cleanup will be invoked once.
shutdown = func(ctx context.Context) error {
var err error
var errs error
for _, fn := range shutdownFuncs {
err = errors.Join(err, fn(ctx))
errs = errors.Join(errs, fn(ctx))
}
shutdownFuncs = nil
return err
return errs
}

// handleErr calls shutdown for cleanup and makes sure that all errors are returned.
Expand Down
2 changes: 1 addition & 1 deletion examples/go/rolldice.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ func roll() int {
// simulate a long operation
// busy wait to make sure it's shown in the flame graph
start := time.Now()
//nolint:revive // intentional busy wait for flame graph demo
for time.Since(start) < 1*time.Second {
// busy wait
}

//nolint:gosec
Expand Down
Loading