[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [tor-bugs] #31794 [Circumvention/Snowflake]: Errors swallowed



#31794: Errors swallowed
-------------------------------------+------------------------
 Reporter:  sah                      |          Owner:  (none)
     Type:  defect                   |         Status:  new
 Priority:  Medium                   |      Milestone:
Component:  Circumvention/Snowflake  |        Version:
 Severity:  Normal                   |     Resolution:
 Keywords:                           |  Actual Points:
Parent ID:                           |         Points:
 Reviewer:                           |        Sponsor:
-------------------------------------+------------------------

Comment (by sah):

 In fact, if I lint the whole server project I get


 shane@desktop:~/GoLang/src/Tor/snowflake$ golangci-lint run ./...
 broker/broker.go:320:6: ineffectual assignment to `metricsFile`
 (ineffassign)
         var metricsFile io.Writer = os.Stdout
             ^
 broker/snowflake-broker_test.go:506:7: ineffectual assignment to `err`
 (ineffassign)
                         r, err = http.NewRequest("POST",
 "snowflake.broker/proxy", data)
                            ^
 appengine/reflect.go:12:2: could not import google.golang.org/appengine
 (invalid package name: "") (typecheck)
         "google.golang.org/appengine"
         ^
 appengine/reflect.go:13:2: could not import
 google.golang.org/appengine/log (invalid package name: "") (typecheck)
         "google.golang.org/appengine/log"
         ^
 appengine/reflect.go:14:2: could not import
 google.golang.org/appengine/urlfetch (invalid package name: "")
 (typecheck)
         "google.golang.org/appengine/urlfetch"
         ^
 client/snowflake.go:1: /home/shane/GoLang/src/git.torproject.org
 /pluggable-transports/snowflake.git/client/lib/webrtc.go:11:2: could not
 import github.com/dchest/uniuri (invalid package name: "") (typecheck)
 // Client transport plugin for the Snowflake pluggable transport.
 client/lib/webrtc.go:11:2: could not import github.com/dchest/uniuri
 (invalid package name: "") (typecheck)
         "github.com/dchest/uniuri"
         ^
 broker/broker.go:186:9: Error return value of `w.Write` is not checked
 (errcheck)
         w.Write(offer)
                ^
 broker/broker.go:220:10: Error return value of `w.Write` is not checked
 (errcheck)
                 w.Write(answer)
                        ^
 broker/broker.go:227:10: Error return value of `w.Write` is not checked
 (errcheck)
                 w.Write([]byte("timed out waiting for answer!"))
                        ^
 broker/broker.go:291:9: Error return value of `io.Copy` is not checked
 (errcheck)
         io.Copy(w, metricsFile)
                ^
 broker/broker.go:372:34: Error return value of
 `ctx.metrics.LoadGeoipDatabases` is not checked (errcheck)
                         ctx.metrics.LoadGeoipDatabases(geoipDatabase,
 geoip6Database)
                                                       ^
 broker/snowflake-broker_test.go:388:33: Error return value of
 `ctx.metrics.LoadGeoipDatabases` is not checked (errcheck)
                 ctx.metrics.LoadGeoipDatabases("invalid_filename",
 "invalid_filename6")
                                               ^
 proxy-go/snowflake.go:209:18: Error return value of `tc.c.SetDeadline` is
 not checked (errcheck)
         tc.c.SetDeadline(time.Now().Add(tc.t))
                         ^
 proxy-go/snowflake.go:214:18: Error return value of `tc.c.SetDeadline` is
 not checked (errcheck)
         tc.c.SetDeadline(time.Now().Add(tc.t))
                         ^
 proxy-go/snowflake.go:228:10: Error return value of `io.Copy` is not
 checked (errcheck)
                 io.Copy(dst, src)
                        ^
 proxy-go/snowflake.go:308:22: Error return value of `pw.CloseWithError` is
 not checked (errcheck)
                                 pw.CloseWithError(err)
                                                  ^
 proxy-go/snowflake.go:320:13: Error return value of `pc.Destroy` is not
 checked (errcheck)
                 pc.Destroy()
                           ^
 proxy-go/snowflake.go:331:13: Error return value of `pc.Destroy` is not
 checked (errcheck)
                 pc.Destroy()
                           ^
 proxy-go/snowflake.go:336:13: Error return value of `pc.Destroy` is not
 checked (errcheck)
                 pc.Destroy()
                           ^
 server-webrtc/snowflake.go:32:10: Error return value of `io.Copy` is not
 checked (errcheck)
                 io.Copy(b, a)
                        ^
 server-webrtc/snowflake.go:144:22: Error return value of
 `pw.CloseWithError` is not checked (errcheck)
                                 pw.CloseWithError(err)
                                                  ^
 server-webrtc/snowflake.go:225:19: Error return value of `pt.SmethodError`
 is not checked (errcheck)
                         pt.SmethodError(bindaddr.MethodName, "no such
 method")
                                        ^
 server/server.go:120:18: Error return value of `local.CloseRead` is not
 checked (errcheck)
                 local.CloseRead()
                                ^
 server/server.go:129:19: Error return value of `local.CloseWrite` is not
 checked (errcheck)
                 local.CloseWrite()
                                 ^
 server/server.go:153:21: Error return value of `ws.Conn.SetDeadline` is
 not checked (errcheck)
         ws.Conn.SetDeadline(time.Time{})
                            ^
 server/server.go:335:19: Error return value of `pt.SmethodError` is not
 checked (errcheck)
                         pt.SmethodError(bindaddr.MethodName, "no such
 method")
                                        ^
 server/server.go:346:20: Error return value of `pt.SmethodError` is not
 checked (errcheck)
                                 pt.SmethodError(bindaddr.MethodName,
 "HTTP-01 ACME listener: "+err.Error())
                                                ^
 server-webrtc/snowflake.go:142:7: shadow: declaration of "err" shadows
 declaration at line 116 (govet)
                         n, err := pw.Write(msg)
                            ^
 server-webrtc/snowflake.go:193:6: shadow: declaration of "err" shadows
 declaration at line 183 (govet)
                 f, err := os.OpenFile(logFilename,
 os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0600)
                    ^
 broker/broker.go:342:3: shadow: declaration of "err" shadows declaration
 at line 319 (govet)
                 err := ctx.metrics.LoadGeoipDatabases(geoipDatabase,
 geoip6Database)
                 ^
 proxy-go/snowflake.go:306:7: shadow: declaration of "err" shadows
 declaration at line 279 (govet)
                         n, err := pw.Write(msg)
                            ^
 server/server.go:310:13: shadow: declaration of "err" shadows declaration
 at line 297 (govet)
                 cacheDir, err := getCertificateCacheDir()
                           ^
 server/server.go:343:14: shadow: declaration of "err" shadows declaration
 at line 297 (govet)
                         lnHTTP01, err := net.ListenTCP("tcp", &addr)
                                   ^
 server-webrtc/snowflake.go:82:20: error strings should not be capitalized
 or end with punctuation or a newline (golint)
         return fmt.Errorf("SetDeadline not implemented")
                           ^
 server-webrtc/snowflake.go:86:20: error strings should not be capitalized
 or end with punctuation or a newline (golint)
         return fmt.Errorf("SetReadDeadline not implemented")
                           ^
 server-webrtc/snowflake.go:90:20: error strings should not be capitalized
 or end with punctuation or a newline (golint)
         return fmt.Errorf("SetWriteDeadline not implemented")
                           ^
 server-webrtc/snowflake.go:230:24: should drop = 0 from declaration of var
 numHandlers; it is the zero value (golint)
         var numHandlers int = 0
                               ^
 broker/metrics.go:136:9: `if` block ends with a `return` statement, so
 drop this `else` and outdent its block (golint)
         } else {
                ^
 broker/metrics.go:145:9: `if` block ends with a `return` statement, so
 drop this `else` and outdent its block (golint)
         } else {
                ^
 server/server.go:78:10: should replace `errors.New(fmt.Sprintf(...))` with
 `fmt.Errorf(...)` (golint)
                         err = errors.New(fmt.Sprintf("got non-binary
 opcode %d", m.Opcode))
                               ^
 server/server.go:382:24: should drop = 0 from declaration of var
 numHandlers; it is the zero value (golint)
         var numHandlers int = 0
                               ^
 server/stats.go:30:5: should replace `numClientIP += 1` with
 `numClientIP++` (golint)
                                 numClientIP += 1
                                 ^
 server/stats.go:32:4: should replace `numConnections += 1` with
 `numConnections++` (golint)
                         numConnections += 1
                         ^
 broker/metrics.go:124:2: S1023: redundant `return` statement (gosimple)
         return
         ^
 broker/snowflake-broker_test.go:184:42: S1019: should use make([]byte,
 100001) instead (gosimple)
                                 data := bytes.NewReader(make([]byte,
 100001, 100001))
                                                                      ^
 broker/snowflake-broker_test.go:184:42: S1019: should use make([]byte,
 100001) instead (gosimple)
                                 data := bytes.NewReader(make([]byte,
 100001, 100001))
                                                                      ^

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/31794#comment:1>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs