Skip to content

Commit e5f882d

Browse files
committed
cmd/golangorg: fix CachedURL, update rebuild template
The "not modified" response code is 304, not 206. Oops. Use named constants to avoid similar mistakes in the future. Also update rebuild template to show more version information. For golang/go#57120. For golang/go#58884. Change-Id: I2c3ddf25cede0b5a853fa971226463a997f168c7 Reviewed-on: https://go-review.googlesource.com/c/website/+/515455 TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Run-TryBot: Russ Cox <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]>
1 parent 1e75b26 commit e5f882d

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

_content/rebuild.html

+3-2
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,9 @@
5555
{{$Report := json gorebuild}}
5656
{{with $Report}}
5757

58-
Using gorebuild from {{.Version}}<br><br>
59-
58+
Gorebuild version {{.Version}}.<br>
59+
Built with Go version {{.GoVersion}}, {{.GOOS}}-{{.GOARCH}}.<br>
60+
<br>
6061
Rebuild started at {{(rfc3339 .Start).UTC.Format "2006-01-02 15:04:05"}} UTC.<br>
6162
Rebuild finished at {{(rfc3339 .End).UTC.Format "2006-01-02 15:04:05"}} UTC.<br>
6263
Elapsed time: {{((rfc3339 .End).Sub (rfc3339 .Start)).Round 1e9}}.

cmd/golangorg/server.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -855,13 +855,13 @@ func (c *CachedURL) Get() (data []byte, err error) {
855855
return nil, fmt.Errorf("loading rebuild report JSON: %v", err)
856856
}
857857
defer resp.Body.Close()
858-
if resp.StatusCode == 206 {
858+
if resp.StatusCode == http.StatusNotModified {
859859
// Unmodified.
860860
log.Printf("checked %s - unmodified", c.url)
861861
return c.data, c.err
862862
}
863863
log.Printf("reloading %s", c.url)
864-
if resp.StatusCode != 200 {
864+
if resp.StatusCode != http.StatusOK {
865865
return nil, fmt.Errorf("loading rebuild report JSON: %v", resp.Status)
866866
}
867867
c.etag = resp.Header.Get("Etag")

0 commit comments

Comments
 (0)