mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-05-12 22:10:25 +00:00
chore: handle error types consistently (#9873)
Some error types are used inconsistently or wrong: - `forgejo.org/modules/git.ErrNotExist` is meant to be a value error: <[modules/git/error.go#L23](https://codeberg.org/forgejo/forgejo/src/tag/v13.0.2/modules/git/error.go#L23)> - `forgejo.org/models/repo.ErrRepoNotExist` is meant to be a value error: <[models/repo/repo.go#L750](https://codeberg.org/forgejo/forgejo/src/tag/v13.0.2/models/repo/repo.go#L750)> - `errors.Is(logErr, &net.OpError{})` is always `false`: <[services/context/context_response.go#L188](https://codeberg.org/forgejo/forgejo/src/tag/v13.0.2/services/context/context_response.go#L188)> - `forgejo.org/models/issues.ErrIssueContentHistoryNotExist` is used inconsistently: <[models/issues/content_history.go#L211](https://codeberg.org/forgejo/forgejo/src/tag/v13.0.2/models/issues/content_history.go#L211)> Decided to use a value, since the structure is small and to be in line with the above errors. These issued where found with the [errortype](https://codeberg.org/fillmore-labs/errortype) linter and add this to Makefile as part of the linter suite. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/9873 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: Oliver Eikemeier <eikemeier@fillmore-labs.com> Co-committed-by: Oliver Eikemeier <eikemeier@fillmore-labs.com>
This commit is contained in:
parent
06f0788e00
commit
757eb2f267
6 changed files with 10 additions and 6 deletions
|
|
@ -39,7 +39,7 @@ func fileStatDevIno(file *os.File) (uint64, uint64, bool) {
|
|||
|
||||
// Do a type conversion to uint64, because Dev isn't always uint64
|
||||
// on every operating system + architecture combination.
|
||||
return uint64(stat.Dev), stat.Ino, true //nolint:unconvert
|
||||
return uint64(stat.Dev), stat.Ino, true //nolint:unconvert,nolintlint
|
||||
}
|
||||
|
||||
func fileIsDevIno(file *os.File, dev, ino uint64) bool {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue