1
0
mirror of https://github.com/golang/go synced 2024-09-24 17:20:12 -06:00

rename the public exvar package to be expvar.

R=rsc
DELTA=684  (324 added, 324 deleted, 36 changed)
OCL=35161
CL=35163
This commit is contained in:
Rob Pike 2009-09-30 13:11:33 -07:00
parent 164a7bceeb
commit 0632bb4ae5
6 changed files with 14 additions and 14 deletions

View File

@ -26,7 +26,7 @@ debug/gosym.install: debug/binary.install fmt.install os.install strconv.install
debug/proc.install: container/vector.install fmt.install io.install os.install runtime.install strconv.install strings.install sync.install syscall.install
ebnf.install: container/vector.install go/scanner.install go/token.install os.install strconv.install unicode.install utf8.install
exec.install: os.install strings.install
exvar.install: bytes.install fmt.install http.install log.install strconv.install sync.install
expvar.install: bytes.install fmt.install http.install log.install strconv.install sync.install
flag.install: fmt.install os.install strconv.install
fmt.install: io.install os.install reflect.install strconv.install utf8.install
go/ast.install: go/token.install unicode.install utf8.install

View File

@ -40,7 +40,7 @@ DIRS=\
debug/proc\
ebnf\
exec\
exvar\
expvar\
flag\
fmt\
go/ast\

View File

@ -4,8 +4,8 @@
include $(GOROOT)/src/Make.$(GOARCH)
TARG=exvar
TARG=expvar
GOFILES=\
exvar.go\
expvar.go\
include $(GOROOT)/src/Make.pkg

View File

@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// The exvar package provides a standardized interface to public variables,
// The expvar package provides a standardized interface to public variables,
// such as operation counters in servers. It exposes these variables via
// HTTP at /debug/vars in JSON format.
package exvar
package expvar
import (
"bytes";
@ -203,7 +203,7 @@ func Iter() <-chan KeyValue {
return c
}
func exvarHandler(c *http.Conn, req *http.Request) {
func expvarHandler(c *http.Conn, req *http.Request) {
c.SetHeader("content-type", "application/json; charset=utf-8");
fmt.Fprintf(c, "{\n");
first := true;
@ -218,5 +218,5 @@ func exvarHandler(c *http.Conn, req *http.Request) {
}
func init() {
http.Handle("/debug/vars", http.HandlerFunc(exvarHandler));
http.Handle("/debug/vars", http.HandlerFunc(expvarHandler));
}

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package exvar
package expvar
import (
"json";

View File

@ -7,7 +7,7 @@ package main
import (
"bytes";
"bufio";
"exvar";
"expvar";
"flag";
"fmt";
"io";
@ -19,7 +19,7 @@ import (
// hello world, the web server
var helloRequests = exvar.NewInt("hello-requests");
var helloRequests = expvar.NewInt("hello-requests");
func HelloServer(c *http.Conn, req *http.Request) {
helloRequests.Add(1);
io.WriteString(c, "hello, world!\n");
@ -30,7 +30,7 @@ type Counter struct {
n int;
}
// This makes Counter satisfy the exvar.Var interface, so we can export
// This makes Counter satisfy the expvar.Var interface, so we can export
// it directly.
func (ctr *Counter) String() string {
return fmt.Sprintf("%d", ctr.n)
@ -56,7 +56,7 @@ func (ctr *Counter) ServeHTTP(c *http.Conn, req *http.Request) {
// simple file server
var webroot = flag.String("root", "/home/rsc", "web root directory")
var pathVar = exvar.NewMap("file-requests");
var pathVar = expvar.NewMap("file-requests");
func FileServer(c *http.Conn, req *http.Request) {
c.SetHeader("content-type", "text/plain; charset=utf-8");
pathVar.Add(req.Url.Path, 1);
@ -143,7 +143,7 @@ func main() {
// The counter is published as a variable directly.
ctr := new(Counter);
http.Handle("/counter", ctr);
exvar.Publish("counter", ctr);
expvar.Publish("counter", ctr);
http.Handle("/go/", http.HandlerFunc(FileServer));
http.Handle("/flags", http.HandlerFunc(FlagServer));