gofix for go's weekly version: weekly.2011-09-01

This commit is contained in:
mikespook 2011-09-05 12:41:53 +08:00
parent 22866616cd
commit e50c4533af
5 changed files with 500 additions and 502 deletions

View File

@ -205,7 +205,7 @@ func (client *Client) Status(handle string) (known, running bool, numerator, den
if job, err = client.readLastJob(STATUS_RES); err != nil {
return
}
data := bytes.Split(job.Data, []byte{'\x00'}, 5)
data := bytes.SplitN(job.Data, []byte{'\x00'}, 5)
if len(data) != 5 {
err = os.NewError("Data Error.")
return

View File

@ -66,7 +66,7 @@ func (job *ClientJob) Result() (data []byte, err os.Error) {
err = os.NewError("Work exception.")
fallthrough
case WORK_COMPLETE:
s := bytes.Split(job.Data, []byte{'\x00'}, 2)
s := bytes.SplitN(job.Data, []byte{'\x00'}, 2)
if len(s) != 2 {
err = os.NewError("Invalid data.")
return
@ -85,7 +85,7 @@ func (job *ClientJob) Update() (data []byte, err os.Error) {
err = os.NewError("The job is not a update.")
return
}
s := bytes.Split(job.Data, []byte{'\x00'}, 2)
s := bytes.SplitN(job.Data, []byte{'\x00'}, 2)
if len(s) != 2 {
err = os.NewError("Invalid data.")
return

View File

@ -27,7 +27,6 @@ const (
// read buffer size
BUFFER_SIZE = 1024
// \x00REQ
REQ = 5391697
REQ_STR = "\x00REQ"
@ -87,7 +86,7 @@ type Job interface {
// Extract the error message
func getError(data []byte) (eno os.Errno, err os.Error) {
rel := bytes.Split(data, []byte{'\x00'}, 2)
rel := bytes.SplitN(data, []byte{'\x00'}, 2)
if len(rel) != 2 {
err = os.NewError("The input is not a error data.")
return

View File

@ -82,7 +82,6 @@ func (worker *Worker) AddServer(addr string) (err os.Error) {
return
}
// Add a function.
// Plz added job servers first, then functions.
// The API will tell every connected job server that 'I can do this'
@ -224,7 +223,7 @@ func (worker *Worker) exec(job *WorkerJob) (err os.Error) {
} else {
limit = 4
}
jobdata := bytes.Split(job.Data, []byte{'\x00'}, limit)
jobdata := bytes.SplitN(job.Data, []byte{'\x00'}, limit)
job.Handle = string(jobdata[0])
funcname := string(jobdata[1])
if job.DataType == JOB_ASSIGN {