Skip to content

Commit 09c06ae

Browse files
committed
Adjust README ordering, print "serving at", mention errors.
Thanks @Frumious for providing feedback!
1 parent 92727d0 commit 09c06ae

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

README.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Gopherpen
22

3-
This is a template project that will let you easily get started with GopherJS. It includes some simple HTML, CSS, and Go code for the frontend. Make some changes, and refresh in browser to see results.
3+
This is a template project that will let you easily get started with GopherJS. It includes some simple HTML, CSS, and Go code for the frontend. Make some changes, and refresh in browser to see results. When there are errors in your frontend Go code, they will show up in the dev console.
44

55
Once you're done making changes, you can create a static production binary that has all assets built in, and can be deployed to any server.
66

@@ -13,6 +13,12 @@ go get -u github.com/gopherjs/gopherpen
1313
go get -u -tags=dev github.com/gopherjs/gopherpen
1414
```
1515

16+
To run `go generate`, you'll also need:
17+
18+
```
19+
go get -u github.com/shurcooL/vfsgen
20+
```
21+
1622
## Building
1723

1824
### Development Build
@@ -32,14 +38,6 @@ go generate
3238
go build
3339
```
3440

35-
### `go generate` Dependencies
36-
37-
To run `go generate`, you'll also need:
38-
39-
```
40-
go get -u github.com/shurcooL/vfsgen
41-
```
42-
4341
License
4442
-------
4543

main.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ package main
22

33
import (
44
"flag"
5+
"fmt"
56
"html/template"
67
"log"
78
"net/http"
9+
"strings"
810
"sync"
911

1012
"github.com/shurcooL/go/gzip_file_server"
@@ -55,8 +57,17 @@ func main() {
5557
http.HandleFunc("/", mainHandler)
5658
http.Handle("/assets/", gzip_file_server.New(assets))
5759

60+
printServingAt(*httpFlag)
5861
err = http.ListenAndServe(*httpFlag, nil)
5962
if err != nil {
6063
log.Fatalln("ListenAndServe:", err)
6164
}
6265
}
66+
67+
func printServingAt(addr string) {
68+
hostPort := addr
69+
if strings.HasPrefix(hostPort, ":") {
70+
hostPort = "localhost" + hostPort
71+
}
72+
fmt.Printf("serving at http://%s/\n", hostPort)
73+
}

0 commit comments

Comments
 (0)