Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix offBy1 errors #17606

Merged
merged 12 commits into from
Nov 14, 2021
Merged

Fix offBy1 errors #17606

merged 12 commits into from
Nov 14, 2021

Conversation

Gusted
Copy link
Contributor

@Gusted Gusted commented Nov 10, 2021

Note: for firstHashtagIndex I haven't returned a error, as I do think it's possible that legitimate docs don't have #.
But for endColumnsIndex I have returned a error, as it do seems to be necessary.

- Partially resolves go-gitea#17596
- Resolve errors from go-critic `offBy1: Index() can return -1; maybe
you wanted to do Index()+1`.
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Nov 10, 2021
@codecov-commenter
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (main@43bbc54). Click here to learn what that means.
The diff coverage is 0.00%.

❗ Current head 9b8c07d differs from pull request most recent head 1a525b1. Consider uploading reports for the commit 1a525b1 to get more accurate results
Impacted file tree graph

@@           Coverage Diff           @@
##             main   #17606   +/-   ##
=======================================
  Coverage        ?   45.50%           
=======================================
  Files           ?      795           
  Lines           ?    88863           
  Branches        ?        0           
=======================================
  Hits            ?    40441           
  Misses          ?    41906           
  Partials        ?     6516           
Impacted Files Coverage Δ
cmd/docs.go 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 43bbc54...1a525b1. Read the comment docs.

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Nov 10, 2021
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Nov 10, 2021
cmd/docs.go Outdated Show resolved Hide resolved
models/migrations/migrations.go Outdated Show resolved Hide resolved
models/migrations/migrations.go Outdated Show resolved Hide resolved
models/migrations/migrations.go Outdated Show resolved Hide resolved
Co-authored-by: delvh <dev.lh@web.de>
@lafriks
Copy link
Member

lafriks commented Nov 14, 2021

🚀

@lafriks lafriks merged commit d2163df into go-gitea:main Nov 14, 2021
zeripath pushed a commit that referenced this pull request Nov 16, 2021
Backport #17598 
Backport #17606 
Backport #17608 
Backport #17609

- Since https://gitea.com/gitea/test-env/pulls/10 the golangci-lint has been upgraded and is erroring about new warnings in the code, this PR fixes those warnings.
@Gusted Gusted deleted the fix-offBy1 branch November 17, 2021 19:19
@zeripath zeripath added the backport/done All backports for this PR have been created label Dec 25, 2021
Chianina pushed a commit to Chianina/gitea that referenced this pull request Mar 28, 2022
* Fix offBy1 errors

- Partially resolves go-gitea#17596
- Resolve errors from go-critic `offBy1: Index() can return -1; maybe
you wanted to do Index()+1`.

* Match golang spec

* Remove comments

* Update migrations.go

* Apply suggestions from code review

Co-authored-by: delvh <dev.lh@web.de>

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
@go-gitea go-gitea locked and limited conversation to collaborators Apr 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport/done All backports for this PR have been created lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. topic/code-linting
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants