tty-share icon indicating copy to clipboard operation
tty-share copied to clipboard

Possibly broken usages of Sprintf

Open xelxebar opened this issue 1 year ago • 0 comments

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 != "" {

xelxebar avatar Aug 21 '23 06:08 xelxebar