[CHORE] Remove println
- It's not recommended to use it per the documentation: https://pkg.go.dev/builtin#println.
This commit is contained in:
parent
c3aed7cb69
commit
706846b628
4 changed files with 9 additions and 24 deletions
|
@ -18,8 +18,8 @@ import (
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
if len(os.Args) != 2 {
|
if len(os.Args) != 2 {
|
||||||
println("usage: backport-locales <to-ref>")
|
fmt.Println("usage: backport-locales <to-ref>")
|
||||||
println("eg: backport-locales release/v1.19")
|
fmt.Println("eg: backport-locales release/v1.19")
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
10
cmd/serv.go
10
cmd/serv.go
|
@ -136,7 +136,7 @@ func runServ(c *cli.Context) error {
|
||||||
setup(ctx, c.Bool("debug"))
|
setup(ctx, c.Bool("debug"))
|
||||||
|
|
||||||
if setting.SSH.Disabled {
|
if setting.SSH.Disabled {
|
||||||
println("Forgejo: SSH has been disabled")
|
fmt.Println("Forgejo: SSH has been disabled")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,13 +164,13 @@ func runServ(c *cli.Context) error {
|
||||||
}
|
}
|
||||||
switch key.Type {
|
switch key.Type {
|
||||||
case asymkey_model.KeyTypeDeploy:
|
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:
|
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:
|
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
|
return nil
|
||||||
} else if c.Bool("debug") {
|
} else if c.Bool("debug") {
|
||||||
log.Debug("SSH_ORIGINAL_COMMAND: %s", os.Getenv("SSH_ORIGINAL_COMMAND"))
|
log.Debug("SSH_ORIGINAL_COMMAND: %s", os.Getenv("SSH_ORIGINAL_COMMAND"))
|
||||||
|
|
|
@ -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) {
|
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")
|
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)
|
assert.EqualValues(t, 19, leftLine)
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
package e2e
|
package e2e
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
|
@ -24,7 +25,7 @@ func TestDebugserver(t *testing.T) {
|
||||||
signal.Notify(done, syscall.SIGINT, syscall.SIGTERM)
|
signal.Notify(done, syscall.SIGINT, syscall.SIGTERM)
|
||||||
|
|
||||||
onGiteaRun(t, func(*testing.T, *url.URL) {
|
onGiteaRun(t, func(*testing.T, *url.URL) {
|
||||||
println(setting.AppURL)
|
fmt.Println(setting.AppURL)
|
||||||
<-done
|
<-done
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue