Update to Go 8944

Change-Id: I7940180cbe882884286e56ee4fc7bf5589aad9e0
This commit is contained in:
Brad Fitzpatrick 2011-06-29 21:13:03 -07:00
parent 92880a083d
commit 15057eec02
12 changed files with 25 additions and 27 deletions

View File

@ -1 +1 @@
6g version weekly.2011-06-16 8858+
6g version release.r58 8944

View File

@ -67,12 +67,12 @@ func main() {
log.Printf("Need to fetch %s", br.String())
}
var (
r io.ReadCloser
r io.ReadCloser
err os.Error
)
if len(*flagVia) > 0 {
vs := strings.Split(*flagVia, ",", -1)
vs := strings.Split(*flagVia, ",")
abr := make([]*blobref.BlobRef, len(vs))
for i, sbr := range vs {
abr[i] = blobref.Parse(sbr)

View File

@ -61,7 +61,7 @@ func IsAuthorized(req *http.Request) bool {
if err != nil {
return false
}
userpass := strings.Split(string(decBuf[0:n]), ":", 2)
userpass := strings.SplitN(string(decBuf[0:n]), ":", 2)
if len(userpass) != 2 {
fmt.Println("didn't get two pieces")
return false
@ -72,8 +72,8 @@ func IsAuthorized(req *http.Request) bool {
// requireAuth wraps a function with another function that enforces
// HTTP Basic Auth.
func RequireAuth(handler func(conn http.ResponseWriter, req *http.Request)) func (conn http.ResponseWriter, req *http.Request) {
return func (conn http.ResponseWriter, req *http.Request) {
func RequireAuth(handler func(conn http.ResponseWriter, req *http.Request)) func(conn http.ResponseWriter, req *http.Request) {
return func(conn http.ResponseWriter, req *http.Request) {
if IsAuthorized(req) {
handler(conn, req)
} else {
@ -81,4 +81,3 @@ func RequireAuth(handler func(conn http.ResponseWriter, req *http.Request)) func
}
}
}

View File

@ -197,7 +197,7 @@ blobRef *blobref.BlobRef, fetcher blobref.StreamingFetcher) {
}()
viaBlobs := make([]*blobref.BlobRef, 0)
if via := req.FormValue("via"); via != "" {
for _, vs := range strings.Split(via, ",", -1) {
for _, vs := range strings.Split(via, ",") {
if br := blobref.Parse(vs); br == nil {
httputil.BadRequestError(conn, "Malformed blobref in via param")
return

View File

@ -50,7 +50,7 @@ func sendTestBlobs(ch chan blobref.SizedBlobRef, list string) {
if list == "" {
return
}
for _, b := range strings.Split(list, ",", -1) {
for _, b := range strings.Split(list, ",") {
br := blobref.Parse(b)
if br == nil {
panic("Invalid blobref: " + b)

View File

@ -38,7 +38,7 @@ var ErrNoData = os.NewError("GPG_ERR_NO_DATA cache miss")
var ErrCancel = os.NewError("gpgagent: Cancel")
func NewConn() (*Conn, os.Error) {
sp := strings.Split(os.Getenv("GPG_AGENT_INFO"), ":", 3)
sp := strings.SplitN(os.Getenv("GPG_AGENT_INFO"), ":", 3)
if len(sp) == 0 || len(sp[0]) == 0 {
return nil, ErrNoAgent
}
@ -153,7 +153,7 @@ func (c *Conn) GetPassphrase(pr *PassphraseRequest) (passphrase string, outerr o
}
return string(decb), nil
}
fields := strings.Split(line, " ", -1)
fields := strings.Split(line, " ")
if len(fields) >= 2 && fields[0] == "ERR" {
switch fields[1] {
case "67108922":

View File

@ -235,7 +235,7 @@ func parseRange(s string, size int64) ([]httpRange, os.Error) {
return nil, os.NewError("invalid range")
}
var ranges []httpRange
for _, ra := range strings.Split(s[len(b):], ",", -1) {
for _, ra := range strings.Split(s[len(b):], ",") {
i := strings.Index(ra, "-")
if i < 0 {
return nil, os.NewError("invalid range")
@ -290,4 +290,3 @@ func ServeFile(w http.ResponseWriter, r *http.Request, name string) {
func ServeFileFromFS(w http.ResponseWriter, r *http.Request, fs FileSystem, name string) {
serveFile(w, r, name, fs, false)
}

View File

@ -91,10 +91,10 @@ type Superset struct {
}
type ContentPart struct {
BlobRef *blobref.BlobRef "blobRef"
SubBlobRef *blobref.BlobRef "subFileBlobRef"
Size uint64 "size"
Offset uint64 "offset"
BlobRef *blobref.BlobRef "blobRef"
SubBlobRef *blobref.BlobRef "subFileBlobRef"
Size uint64 "size"
Offset uint64 "offset"
}
func stringFromMixedArray(parts []interface{}) string {
@ -418,7 +418,7 @@ func populateMap(m map[int]string, file string) {
if err != nil {
return
}
parts := strings.Split(line, ":", 4)
parts := strings.SplitN(line, ":", 4)
if len(parts) >= 3 {
idstr := parts[2]
id, err := strconv.Atoi(idstr)

View File

@ -412,14 +412,14 @@ func (me *MountState) dispatch(req *fuseRequest) {
case FUSE_RMDIR:
status = fs.Rmdir(h, filename)
case FUSE_SYMLINK:
filenames := strings.Split(string(req.arg.Bytes()), "\x00", 3)
filenames := strings.SplitN(string(req.arg.Bytes()), "\x00", 3)
if len(filenames) >= 2 {
out, status = fs.Symlink(h, filenames[1], filenames[0])
} else {
status = EIO
}
case FUSE_RENAME:
filenames := strings.Split(string(req.arg.Bytes()), "\x00", 3)
filenames := strings.SplitN(string(req.arg.Bytes()), "\x00", 3)
if len(filenames) >= 2 {
status = fs.Rename(h, input.(*RenameIn), filenames[0], filenames[1])
} else {

View File

@ -278,7 +278,7 @@ func (me *PathFileSystemConnector) unlinkUpdate(nodeid uint64, name string) {
// Walk the file system starting from the root.
func (me *PathFileSystemConnector) findInode(fullPath string) *inodeData {
fullPath = strings.TrimLeft(filepath.Clean(fullPath), "/")
comps := strings.Split(fullPath, "/", -1)
comps := strings.Split(fullPath, "/")
me.lock.RLock()
defer me.lock.RUnlock()

View File

@ -65,6 +65,6 @@ func ListXAttr(path string) (attributes [][]byte, errno int) {
// -1 to drop the final empty slice.
dest = dest[:sz-1]
attributes = bytes.Split(dest, []byte{0}, -1)
attributes = bytes.Split(dest, []byte{0})
return attributes, errno
}

View File

@ -262,10 +262,10 @@ func main() {
}
mux := http.DefaultServeMux
mux.Handle("/favicon.ico", http.FileServer(filepath.Join(*root, "static"), "/"))
mux.Handle("/robots.txt", http.FileServer(filepath.Join(*root, "static"), "/"))
mux.Handle("/static/", http.FileServer(filepath.Join(*root, "static"), "/static/"))
mux.Handle("/talks/", http.FileServer(filepath.Join(*root, "talks"), "/talks/"))
mux.Handle("/favicon.ico", http.FileServer(http.Dir(filepath.Join(*root, "static"))))
mux.Handle("/robots.txt", http.FileServer(http.Dir(filepath.Join(*root, "static"))))
mux.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir(filepath.Join(*root, "static")))))
mux.Handle("/talks/", http.StripPrefix("/talks/", http.FileServer(http.Dir(filepath.Join(*root, "talks")))))
gerritUrl, _ := http.ParseURL("http://gerrit-proxy:8000/")
var gerritHandler http.Handler = http.NewSingleHostReverseProxy(gerritUrl)
@ -299,7 +299,7 @@ func main() {
Root: "/code/",
Env: env,
},
Static: http.FileServer(*gitwebFiles, "/code/"),
Static: http.StripPrefix("/code/", http.FileServer(http.Dir(*gitwebFiles))),
}})
}
mux.HandleFunc("/", mainHandler)