Skip to content

Commit

Permalink
outyet: update example, make a separate module
Browse files Browse the repository at this point in the history
We want to revive golang.org/x/example as a test case for
an experiment with a 'gonew' command.

This CL updates outyet to be a gonew-able sample server,
by making it its own module. The CL also removes
Dockerfile and containers.yaml because I think the
best practices around those files have evolved too much
since 2015 when they were written.

Change-Id: I53faf4b30de9e4ef3bfe35a781732daa140a9877
Reviewed-on: https://go-review.googlesource.com/c/example/+/513998
TryBot-Result: Gopher Robot <[email protected]>
Run-TryBot: Russ Cox <[email protected]>
Auto-Submit: Russ Cox <[email protected]>
Reviewed-by: Cameron Balahan <[email protected]>
  • Loading branch information
rsc authored and gopherbot committed Jul 31, 2023
1 parent 3dc2413 commit 0c9b5c5
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 11 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,21 @@ The [reverse](hello/reverse/) reverse covers:
* Conversion between string and []rune
* Table-driven unit tests ([testing](//golang.org/pkg/testing/))

## [helloserver](helloserver/)

```
$ cd helloserver
$ go run .
```

A trivial "Hello, world" web server.

Topics covered:

* Command-line flags ([flag](//golang.org/pkg/flag/))
* Logging ([log](//golang.org/pkg/log/))
* Web servers ([net/http](//golang.org/pkg/net/http/))

## [outyet](outyet/)

```
Expand Down
2 changes: 0 additions & 2 deletions outyet/Dockerfile

This file was deleted.

8 changes: 0 additions & 8 deletions outyet/containers.yaml

This file was deleted.

4 changes: 4 additions & 0 deletions outyet/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module golang.org/x/example/outyet

go 1.19

3 changes: 2 additions & 1 deletion outyet/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (

// Command-line flags.
var (
httpAddr = flag.String("http", ":8080", "Listen address")
httpAddr = flag.String("http", "localhost:8080", "Listen address")
pollPeriod = flag.Duration("poll", 5*time.Second, "Poll period")
version = flag.String("version", "1.4", "Go version")
)
Expand All @@ -30,6 +30,7 @@ func main() {
flag.Parse()
changeURL := fmt.Sprintf("%sgo%s", baseChangeURL, *version)
http.Handle("/", NewServer(*version, changeURL, *pollPeriod))
log.Printf("serving http://%s", *httpAddr)
log.Fatal(http.ListenAndServe(*httpAddr, nil))
}

Expand Down

0 comments on commit 0c9b5c5

Please sign in to comment.