How to use a code signing certificate for Windows 10 so that the UAC prompts don't show warnings.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
643 B

  1. //go:generate goversioninfo
  2. /*Serve is a very simple static file server in go
  3. Usage:
  4. -p="8100": port to serve on
  5. -d=".": the directory of static files to host
  6. Navigating to http://localhost:8100 will display the index.html or directory
  7. listing file.
  8. */
  9. package main
  10. import (
  11. "flag"
  12. "log"
  13. "net/http"
  14. )
  15. func main() {
  16. port := flag.String("p", "80", "port to serve on")
  17. directory := flag.String("d", ".", "the directory of static file to host")
  18. flag.Parse()
  19. http.Handle("/", http.FileServer(http.Dir(*directory)))
  20. log.Printf("Serving %s on HTTP port: %s\n", *directory, *port)
  21. log.Fatal(http.ListenAndServe(":"+*port, nil))
  22. }