github.com/go-asm/go@v1.21.1-0.20240213172139-40c5ead50c48/cmd/go/vcweb/dir.go (about) 1 // Copyright 2022 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package vcweb 6 7 import ( 8 "log" 9 "net/http" 10 ) 11 12 // dirHandler is a vcsHandler that serves the raw contents of a directory. 13 type dirHandler struct{} 14 15 func (*dirHandler) Available() bool { return true } 16 17 func (*dirHandler) Handler(dir string, env []string, logger *log.Logger) (http.Handler, error) { 18 return http.FileServer(http.Dir(dir)), nil 19 }