gogs / git

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

Use pre-defined error instances #13

Closed shazow closed 8 years ago

shazow commented 8 years ago

Hiya, right now there are a bunch of errors.New(fmt.Sprintf(...)) all over the code, and the string is often dynamic so it makes it hard to compare conditions programmatically.

For instance, when an object is not found: https://github.com/gogits/git/blob/16f4de6a9d8a6695826ef4118f58dff85174b335/repo_object.go#L81

I propose we pull out at least the more common errors into package variables so that the conditions can be compared against. We can still make the Error() messages dynamically generated, so the output will stay the same.

(Happy to work on a PR for this, just let me know!)

unknwon commented 8 years ago

Hi there,

This repository is kind of suspend for maintenance, but may continue in the future.

Hmm... so the point is I don't want waste your time. :sweat:

shazow commented 8 years ago

Would you recommend not using this? Do you have suggestions for an alternative? Should I start my own fork? :)

unknwon commented 8 years ago

Would you recommend not using this?

Code most likely is not going to change.

Should I start my own fork?

Yes, I think so.

shazow commented 8 years ago

Very well, thanks for letting me know, and thanks for the great work so far!

unknwon commented 8 years ago

:trollface: Gogs currently is using git-shell, may come back to manipulate internal objects after 1.0 release when we got enough time