1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-11-28 09:21:13 -05:00

Merge pull request '[CHORE] Remove println' (#3185) from gusted/forgejo-println into forgejo

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3185
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
This commit is contained in:
Gusted 2024-04-12 12:35:38 +00:00
commit 0c42e3c755
4 changed files with 9 additions and 24 deletions

View file

@ -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)
} }

View file

@ -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"))

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) { 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)

View file

@ -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
}) })
} }