gogs / git

Package GoGits - Git is a pure Go implementation of Git manipulation.
Apache License 2.0
176 stars 32 forks source link

refactor repo_util* for go-1.7 #20

Closed lemmi closed 8 years ago

lemmi commented 8 years ago

18 #19

This is the alternative approach to the problem with the early EOF from reads since go 1.7. Changes made:

repo_utils_reader.go:

repo_utils.go

the EOF bug can potentially still happen in https://github.com/lemmi/git/blob/e11be8e1fd55c2ec996a27eb3665d33024c771ad/repo_utils.go#L143 . This could need another rewrite, too, but I'm not yet familiar with the git pack format. A lot of other places in that file could really benefit from encoding/binary. I'll open up issues for these parts.

If there are coding style issues, let me know and please test these changes, too. They work here, also the small go test passes.

unknwon commented 8 years ago

Does the code still works under go1.6 or earlier Go version?

lemmi commented 8 years ago

I ran all my tests on 1.6 again without errors. And as far as I can tell, these changes use nothing 1.7 specific like new methods on some of the Readers.

snicol commented 8 years ago

Using this test script on 1.7 I get this:

  go run get_commit.go                                                                                                                                                                   
  2016/08/18 12:22:37 EOF
  exit status 1

However it does work on 1.6.

lemmi commented 8 years ago

@snicol I did not commit to master. Did you checkout the go1.7 branch?

snicol commented 8 years ago

Ah that was it, oops! I just tested on 1.6 and 1.7 on Darwin and linux-amd64 and can't see any regressions. Good work! 👍

unknwon commented 8 years ago

Thanks!