aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/protocol/packp/srvresp.go
diff options
context:
space:
mode:
authorferhat elmas <elmas.ferhat@gmail.com>2017-11-29 02:24:31 +0100
committerferhat elmas <elmas.ferhat@gmail.com>2017-11-29 13:01:32 +0100
commit18e6f9daa3899318d36b525b068837f49bc2c1cf (patch)
treea797b79d0a750972ba9809eb52691cb09f9b6383 /plumbing/protocol/packp/srvresp.go
parentc07c778ed043429427533e2fd7549a3d54b903f1 (diff)
downloadgo-git-18e6f9daa3899318d36b525b068837f49bc2c1cf.tar.gz
all: simplification
- no length for map initialization - don't check for boolean/error return - don't format string - use string method of bytes buffer instead of converting bytes to string - use `strings.Contains` instead of `strings.Index` - use `bytes.Equal` instead of `bytes.Compare`
Diffstat (limited to 'plumbing/protocol/packp/srvresp.go')
-rw-r--r--plumbing/protocol/packp/srvresp.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/plumbing/protocol/packp/srvresp.go b/plumbing/protocol/packp/srvresp.go
index 434e8aa..6a91991 100644
--- a/plumbing/protocol/packp/srvresp.go
+++ b/plumbing/protocol/packp/srvresp.go
@@ -77,7 +77,7 @@ func (r *ServerResponse) stopReading(reader *bufio.Reader) (bool, error) {
func (r *ServerResponse) isValidCommand(b []byte) bool {
commands := [][]byte{ack, nak}
for _, c := range commands {
- if bytes.Compare(b, c) == 0 {
+ if bytes.Equal(b, c) {
return true
}
}
@@ -90,11 +90,11 @@ func (r *ServerResponse) decodeLine(line []byte) error {
return fmt.Errorf("unexpected flush")
}
- if bytes.Compare(line[0:3], ack) == 0 {
+ if bytes.Equal(line[0:3], ack) {
return r.decodeACKLine(line)
}
- if bytes.Compare(line[0:3], nak) == 0 {
+ if bytes.Equal(line[0:3], nak) {
return nil
}