elisescu / tty-share

Share your linux or osx terminal over the Internet.
https://tty-share.com/
MIT License
806 stars 87 forks source link

Possibly broken usages of Sprintf #75

Open xelxebar opened 1 year ago

xelxebar commented 1 year ago

Overview

The following warnings show up in my editor's linter:

$ go test
# github.com/elisescu/tty-share
./client.go:197:14: github.com/sirupsen/logrus.Warnf call has arguments but no formatting directives
./client.go:203:14: github.com/sirupsen/logrus.Warnf call has arguments but no formatting directives
./main.go:159:14: fmt.Sprintf call has arguments but no formatting directives

Patch

Is the intention something like this:

diff --git a/client.go b/client.go
index 61f278d..a78546f 100644
--- a/client.go
+++ b/client.go
@@ -194,13 +194,13 @@ func (c *ttyShareClient) Run() (err error) {
            localTunconn, err := localListener.Accept()

            if err != nil {
-               log.Warnf("Cannot accept local tunnel connections: ", err.Error())
+               log.Warnf("Cannot accept local tunnel connections: %s", err.Error())
                return
            }

            muxClient, err := c.tunnelMuxSession.Open()
            if err != nil {
-               log.Warnf("Cannot create a muxer to the remote, over ws: ", err.Error())
+               log.Warnf("Cannot create a muxer to the remote, over ws: %s", err.Error())
                return
            }

diff --git a/main.go b/main.go
index c8715a4..c092c46 100644
--- a/main.go
+++ b/main.go
@@ -156,7 +156,7 @@ Flags:
    envVars := os.Environ()
    envVars = append(envVars,
        fmt.Sprintf("TTY_SHARE_LOCAL_URL=http://%s", *listenAddress),
-       fmt.Sprintf("TTY_SHARE=1", os.Getpid()),
+       fmt.Sprintf("TTY_SHARE=1"),
    )

    if publicURL != "" {