本文整理汇总了Golang中code/google/com/p/go/tools/godoc.Presentation.FileServer方法的典型用法代码示例。如果您正苦于以下问题:Golang Presentation.FileServer方法的具体用法?Golang Presentation.FileServer怎么用?Golang Presentation.FileServer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类code/google/com/p/go/tools/godoc.Presentation
的用法示例。
在下文中一共展示了Presentation.FileServer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: registerHandlers
func registerHandlers(pres *godoc.Presentation) {
if pres == nil {
panic("nil Presentation")
}
http.HandleFunc("/doc/codewalk/", codewalk)
http.Handle("/doc/play/", pres.FileServer())
http.Handle("/robots.txt", pres.FileServer())
http.Handle("/", pres)
redirect.Register(nil)
}
示例2: registerHandlers
func registerHandlers(pres *godoc.Presentation) {
if pres == nil {
panic("nil Presentation")
}
http.HandleFunc("/doc/codewalk/", codewalk)
http.Handle("/doc/play/", pres.FileServer())
http.Handle("/robots.txt", pres.FileServer())
http.Handle("/", pres)
handlePathRedirects(pkgRedirects, "/pkg/")
handlePathRedirects(cmdRedirects, "/cmd/")
for prefix, redirect := range prefixHelpers {
p := "/" + prefix + "/"
h := makePrefixRedirectHandler(p, redirect)
http.HandleFunc(p, h)
}
for path, redirect := range redirects {
h := makeRedirectHandler(redirect)
http.HandleFunc(path, h)
}
}