1

我目前在 Go 中有一个函数,如果在创建新服务器时传递了挂载点,它会创建一个子路由器。我想使用muxtrace.

import {
  muxtrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/gorilla/mux"
  ...
}

...

router := muxtrace.NewRouter()

if mountpoint != "" {
    router = router.PathPrefix(mountpoint).Subrouter()
}

router = router.PathPrefix(mountpoint).Subrouter()返回错误:

cannot use router.PathPrefix(mountpoint).Subrouter() (value of type *mux.Router) as *mux.Router value in assignment

看起来*mux.Router跟踪包中使用的类型没有子路由器。那么我将如何追踪子路线呢?

4

0 回答 0