Skip to content

Commit

Permalink
a few code simplifications
Browse files Browse the repository at this point in the history
ran gosimple over the code and made suggested adjustments
  • Loading branch information
John Eikenberry committed Feb 15, 2018
1 parent 9649a98 commit 161bbaf
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion attrs.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func getFileStat(flags uint32, b []byte) (*FileStat, []byte) {
if flags&ssh_FILEXFER_ATTR_EXTENDED == ssh_FILEXFER_ATTR_EXTENDED {
var count uint32
count, b = unmarshalUint32(b)
ext := make([]StatExtended, count, count)
ext := make([]StatExtended, count)
for i := uint32(0); i < count; i++ {
var typ string
var data string
Expand Down
2 changes: 1 addition & 1 deletion client_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func newDelayedWriter(w io.WriteCloser, delay time.Duration) io.WriteCloser {
closed := make(chan struct{})
go func() {
for writeMsg := range ch {
time.Sleep(writeMsg.t.Add(delay).Sub(time.Now()))
time.Sleep(time.Until(writeMsg.t.Add(delay)))
n, err := w.Write(writeMsg.b)
if err != nil {
panic("write error")
Expand Down
2 changes: 1 addition & 1 deletion request-example.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func (fs *root) Filelist(r *Request) (ListerAt, error) {
ordered_names = append(ordered_names, fn)
}
}
sort.Sort(sort.StringSlice(ordered_names))
sort.Strings(ordered_names)
list := make([]os.FileInfo, len(ordered_names))
for i, fn := range ordered_names {
list[i] = fs.files[fn]
Expand Down
2 changes: 1 addition & 1 deletion server_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ func runSftpClient(t *testing.T, script string, path string, host string, port i
return "", err
}
err = cmd.Wait()
return string(stdout.Bytes()), err
return stdout.String(), err
}

func TestServerCompareSubsystems(t *testing.T) {
Expand Down

0 comments on commit 161bbaf

Please sign in to comment.