mirror of
https://github.com/go-gitea/gitea
synced 2025-07-25 19:58:36 +00:00
Run gopls modernize
on codebase (#34751)
Recent modernize fixes: https://github.com/golang/tools/commits/master/gopls/internal/analysis/modernize
This commit is contained in:
@@ -15,7 +15,7 @@ const windowsSharingViolationError syscall.Errno = 32
|
||||
// Remove removes the named file or (empty) directory with at most 5 attempts.
|
||||
func Remove(name string) error {
|
||||
var err error
|
||||
for i := 0; i < 5; i++ {
|
||||
for range 5 {
|
||||
err = os.Remove(name)
|
||||
if err == nil {
|
||||
break
|
||||
@@ -44,7 +44,7 @@ func Remove(name string) error {
|
||||
// RemoveAll removes the named file or (empty) directory with at most 5 attempts.
|
||||
func RemoveAll(name string) error {
|
||||
var err error
|
||||
for i := 0; i < 5; i++ {
|
||||
for range 5 {
|
||||
err = os.RemoveAll(name)
|
||||
if err == nil {
|
||||
break
|
||||
@@ -73,7 +73,7 @@ func RemoveAll(name string) error {
|
||||
// Rename renames (moves) oldpath to newpath with at most 5 attempts.
|
||||
func Rename(oldpath, newpath string) error {
|
||||
var err error
|
||||
for i := 0; i < 5; i++ {
|
||||
for i := range 5 {
|
||||
err = os.Rename(oldpath, newpath)
|
||||
if err == nil {
|
||||
break
|
||||
|
@@ -23,7 +23,7 @@ func TestCompressOldFile(t *testing.T) {
|
||||
ng, err := os.OpenFile(nonGzip, os.O_CREATE|os.O_WRONLY, 0o660)
|
||||
assert.NoError(t, err)
|
||||
|
||||
for i := 0; i < 999; i++ {
|
||||
for range 999 {
|
||||
f.WriteString("This is a test file\n")
|
||||
ng.WriteString("This is a test file\n")
|
||||
}
|
||||
|
@@ -103,7 +103,7 @@ func UnsafeStringToBytes(s string) []byte {
|
||||
func SplitTrimSpace(input, sep string) []string {
|
||||
input = strings.TrimSpace(input)
|
||||
var stringList []string
|
||||
for _, s := range strings.Split(input, sep) {
|
||||
for s := range strings.SplitSeq(input, sep) {
|
||||
if s = strings.TrimSpace(s); s != "" {
|
||||
stringList = append(stringList, s)
|
||||
}
|
||||
|
Reference in New Issue
Block a user