mirror of
https://github.com/matrix-org/dendrite.git
synced 2024-11-23 06:41:56 -06:00
Add staticcheck lint (#245)
This commit is contained in:
parent
584acbe9a9
commit
340a84cdc0
|
@ -17,7 +17,6 @@
|
||||||
"unparam",
|
"unparam",
|
||||||
"errcheck",
|
"errcheck",
|
||||||
"vet",
|
"vet",
|
||||||
"unused",
|
"megacheck"
|
||||||
"gosimple"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,7 +80,9 @@ func main() {
|
||||||
|
|
||||||
aliasAPI.SetupHTTP(http.DefaultServeMux)
|
aliasAPI.SetupHTTP(http.DefaultServeMux)
|
||||||
|
|
||||||
http.DefaultServeMux.Handle("/metrics", prometheus.Handler())
|
// This is deprecated, but prometheus are still arguing on what to replace
|
||||||
|
// it with. Alternatively we could set it up manually.
|
||||||
|
http.DefaultServeMux.Handle("/metrics", prometheus.Handler()) // nolint: staticcheck, megacheck
|
||||||
|
|
||||||
log.Info("Started room server on ", cfg.Listen.RoomServer)
|
log.Info("Started room server on ", cfg.Listen.RoomServer)
|
||||||
|
|
||||||
|
|
|
@ -190,7 +190,7 @@ func getMediaURI(host, endpoint, query string, components []string) string {
|
||||||
func testUpload(host, filePath string) {
|
func testUpload(host, filePath string) {
|
||||||
fmt.Printf("==TESTING== upload %v to %v\n", filePath, host)
|
fmt.Printf("==TESTING== upload %v to %v\n", filePath, host)
|
||||||
file, err := os.Open(filePath)
|
file, err := os.Open(filePath)
|
||||||
defer file.Close() // nolint: errcheck
|
defer file.Close() // nolint: errcheck, staticcheck, megacheck
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
// nolint: varcheck, deadcode, unused
|
// nolint: varcheck, deadcode, unused, megacheck
|
||||||
const (
|
const (
|
||||||
i0StateRoomCreate = iota
|
i0StateRoomCreate = iota
|
||||||
i1StateAliceJoin
|
i1StateAliceJoin
|
||||||
|
|
|
@ -52,6 +52,7 @@ func MakeFedAPI(
|
||||||
// SetupHTTPAPI registers an HTTP API mux under /api and sets up a metrics
|
// SetupHTTPAPI registers an HTTP API mux under /api and sets up a metrics
|
||||||
// listener.
|
// listener.
|
||||||
func SetupHTTPAPI(servMux *http.ServeMux, apiMux *mux.Router) {
|
func SetupHTTPAPI(servMux *http.ServeMux, apiMux *mux.Router) {
|
||||||
servMux.Handle("/metrics", prometheus.Handler())
|
// This is deprecated.
|
||||||
|
servMux.Handle("/metrics", prometheus.Handler()) // nolint: megacheck, staticcheck
|
||||||
servMux.Handle("/api/", http.StripPrefix("/api", apiMux))
|
servMux.Handle("/api/", http.StripPrefix("/api", apiMux))
|
||||||
}
|
}
|
||||||
|
|
|
@ -236,7 +236,7 @@ func (r *downloadRequest) respondFromLocalFile(
|
||||||
return nil, errors.Wrap(err, "failed to get file path from metadata")
|
return nil, errors.Wrap(err, "failed to get file path from metadata")
|
||||||
}
|
}
|
||||||
file, err := os.Open(filePath)
|
file, err := os.Open(filePath)
|
||||||
defer file.Close() // nolint: errcheck
|
defer file.Close() // nolint: errcheck, staticcheck, megacheck
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "failed to open file")
|
return nil, errors.Wrap(err, "failed to open file")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue