13
13
//
14
14
// The flags are:
15
15
//
16
- // -local=path1,path2
17
- // Accepts a GOPATH-like collection of local paths for modules to load to memory
18
16
// -gopath_mode=false
19
17
// Assume that local modules' paths are relative to GOPATH/src
18
+ // -http=:8080
19
+ // HTTP service address to listen for incoming requests on
20
+ // -local=path1,path2
21
+ // Accepts a GOPATH-like collection of local paths for modules to load to memory
20
22
package main
21
23
22
24
import (
@@ -35,10 +37,13 @@ import (
35
37
"golang.org/x/pkgsite/internal/middleware"
36
38
)
37
39
40
+ const defaultAddr = "localhost:8080" // default webserver address
41
+
38
42
var (
39
43
_ = flag .String ("static" , "content/static" , "path to folder containing static files served" )
40
- localPaths = flag .String ("local" , "" , "run locally, accepts a GOPATH-like collection of local paths for modules to load to memory" )
41
44
gopathMode = flag .Bool ("gopath_mode" , false , "assume that local modules' paths are relative to GOPATH/src, used only with -local" )
45
+ httpAddr = flag .String ("http" , defaultAddr , "HTTP service address to listen for incoming requests on" )
46
+ localPaths = flag .String ("local" , "" , "run locally, accepts a GOPATH-like collection of local paths for modules to load to memory" )
42
47
)
43
48
44
49
func main () {
@@ -71,9 +76,8 @@ func main() {
71
76
middleware .LatestVersions (server .GetLatestInfo ), // must come before caching for version badge to work
72
77
middleware .Timeout (54 * time .Second ),
73
78
)
74
- addr := "localhost:6060"
75
- log .Infof (ctx , "Listening on addr %s" , addr )
76
- log .Fatal (ctx , http .ListenAndServe (addr , mw (router )))
79
+ log .Infof (ctx , "Listening on addr %s" , * httpAddr )
80
+ log .Fatal (ctx , http .ListenAndServe (* httpAddr , mw (router )))
77
81
}
78
82
79
83
// load loads local modules from pathList.
0 commit comments