Format codes by gofmt.

This commit is contained in:
mikespook 2011-05-24 13:20:22 +08:00
parent 82f0ab2cd5
commit 7a4bbcdc55
13 changed files with 219 additions and 213 deletions

3
README
View File

@ -16,6 +16,9 @@ It was implemented a native protocol for both worker and client API.
$ make client $ make client
$ ./client $ ./client
- Code format
gofmt -spaces=true -tabwidth=4 -w=true -tabindent=false $(DIR)
---- ----
xingxing<mikespook@gmail.com> xingxing<mikespook@gmail.com>
http://mikespook.com http://mikespook.com

View File

@ -16,3 +16,6 @@ include $(GOROOT)/src/Make.pkg
%: %.go %: %.go
$(GC) $*.go $(GC) $*.go
$(LD) -o $@ $*.$O $(LD) -o $@ $*.$O
fmt:
gofmt -spaces=true -tabwidth=4 -w=true -tabindent=false ./

View File

@ -20,3 +20,6 @@ include $(GOROOT)/src/Make.pkg
%: install %.go %: install %.go
$(GC) $*.go $(GC) $*.go
$(LD) -o $@ $*.$O $(LD) -o $@ $*.$O
fmt:
gofmt -spaces=true -tabwidth=4 -w=true -tabindent=false ./

View File

@ -60,7 +60,7 @@ func (client *Client) read() (data []byte, err os.Error) {
buf := make([]byte, BUFFER_SIZE) buf := make([]byte, BUFFER_SIZE)
var n int var n int
if n, err = client.conn.Read(buf); err != nil { if n, err = client.conn.Read(buf); err != nil {
if (err == os.EOF && n == 0) { if err == os.EOF && n == 0 {
break break
} }
return return
@ -104,7 +104,7 @@ func (client *Client) ReadJob() (job *ClientJob, err os.Error) {
if job, err = DecodeClientJob(rel); err != nil { if job, err = DecodeClientJob(rel); err != nil {
return return
} else { } else {
switch(job.DataType) { switch job.DataType {
case ERROR: case ERROR:
_, err = getError(job.Data) _, err = getError(job.Data)
return return

View File

@ -39,4 +39,3 @@ func TestClientClose(t * testing.T) {
t.Error(err) t.Error(err)
} }
} }

View File

@ -87,5 +87,3 @@ func (job * WorkerJob) UpdateStatus(numerator, denominator int) (err os.Error) {
result = append(result, d...) result = append(result, d...)
return job.client.WriteJob(NewWorkerJob(REQ, WORK_STATUS, result)) return job.client.WriteJob(NewWorkerJob(REQ, WORK_STATUS, result))
} }

View File

@ -90,7 +90,7 @@ func (client *jobClient) Work() {
client.worker.ErrQueue <- err client.worker.ErrQueue <- err
continue continue
} else { } else {
switch(job.DataType) { switch job.DataType {
case NOOP: case NOOP:
noop = true noop = true
case NO_JOB: case NO_JOB: