[CHORE] Remove println

- It's not recommended to use it per the documentation: https://pkg.go.dev/builtin#println.
This commit is contained in:
Gusted 2024-04-12 13:36:31 +02:00
parent c3aed7cb69
commit 706846b628
No known key found for this signature in database
GPG key ID: FD821B732837125F
4 changed files with 9 additions and 24 deletions

View file

@ -18,8 +18,8 @@ import (
func main() {
if len(os.Args) != 2 {
println("usage: backport-locales <to-ref>")
println("eg: backport-locales release/v1.19")
fmt.Println("usage: backport-locales <to-ref>")
fmt.Println("eg: backport-locales release/v1.19")
os.Exit(1)
}

View file

@ -136,7 +136,7 @@ func runServ(c *cli.Context) error {
setup(ctx, c.Bool("debug"))
if setting.SSH.Disabled {
println("Forgejo: SSH has been disabled")
fmt.Println("Forgejo: SSH has been disabled")
return nil
}
@ -164,13 +164,13 @@ func runServ(c *cli.Context) error {
}
switch key.Type {
case asymkey_model.KeyTypeDeploy:
println("Hi there! You've successfully authenticated with the deploy key named " + key.Name + ", but Forgejo does not provide shell access.")
fmt.Println("Hi there! You've successfully authenticated with the deploy key named " + key.Name + ", but Forgejo does not provide shell access.")
case asymkey_model.KeyTypePrincipal:
println("Hi there! You've successfully authenticated with the principal " + key.Content + ", but Forgejo does not provide shell access.")
fmt.Println("Hi there! You've successfully authenticated with the principal " + key.Content + ", but Forgejo does not provide shell access.")
default:
println("Hi there, " + user.Name + "! You've successfully authenticated with the key named " + key.Name + ", but Forgejo does not provide shell access.")
fmt.Println("Hi there, " + user.Name + "! You've successfully authenticated with the key named " + key.Name + ", but Forgejo does not provide shell access.")
}
println("If this is unexpected, please log in with password and setup Forgejo under another user.")
fmt.Println("If this is unexpected, please log in with password and setup Forgejo under another user.")
return nil
} else if c.Bool("debug") {
log.Debug("SSH_ORIGINAL_COMMAND: %s", os.Getenv("SSH_ORIGINAL_COMMAND"))

View file

@ -159,22 +159,6 @@ func BenchmarkCutDiffAroundLine(b *testing.B) {
}
}
func ExampleCutDiffAroundLine() {
const diff = `diff --git a/README.md b/README.md
--- a/README.md
+++ b/README.md
@@ -1,3 +1,6 @@
# gitea-github-migrator
+
+ Build Status
- Latest Release
Docker Pulls
+ cut off
+ cut off`
result, _ := CutDiffAroundLine(strings.NewReader(diff), 4, false, 3)
println(result)
}
func TestParseDiffHunkString(t *testing.T) {
leftLine, leftHunk, rightLine, rightHunk := ParseDiffHunkString("@@ -19,3 +19,5 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER")
assert.EqualValues(t, 19, leftLine)

View file

@ -10,6 +10,7 @@
package e2e
import (
"fmt"
"net/url"
"os"
"os/signal"
@ -24,7 +25,7 @@ func TestDebugserver(t *testing.T) {
signal.Notify(done, syscall.SIGINT, syscall.SIGTERM)
onGiteaRun(t, func(*testing.T, *url.URL) {
println(setting.AppURL)
fmt.Println(setting.AppURL)
<-done
})
}