mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-13 09:53:10 -06:00
Fix unparam lint
This commit is contained in:
parent
4ac7f10af8
commit
e8eceefc43
|
|
@ -33,7 +33,7 @@ type response struct {
|
||||||
// GetMemberships implements GET /rooms/{roomId}/members
|
// GetMemberships implements GET /rooms/{roomId}/members
|
||||||
func GetMemberships(
|
func GetMemberships(
|
||||||
req *http.Request, device *authtypes.Device, roomID string, joinedOnly bool,
|
req *http.Request, device *authtypes.Device, roomID string, joinedOnly bool,
|
||||||
cfg config.Dendrite,
|
_ config.Dendrite,
|
||||||
queryAPI api.RoomserverQueryAPI,
|
queryAPI api.RoomserverQueryAPI,
|
||||||
) util.JSONResponse {
|
) util.JSONResponse {
|
||||||
queryReq := api.QueryMembershipsForRoomRequest{
|
queryReq := api.QueryMembershipsForRoomRequest{
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ var timeout time.Duration
|
||||||
|
|
||||||
var port = 10000
|
var port = 10000
|
||||||
|
|
||||||
func startMediaAPI(suffix string, dynamicThumbnails bool) (*exec.Cmd, chan error, string, *exec.Cmd, chan error, string, string) {
|
func startMediaAPI(suffix string, dynamicThumbnails bool) (*exec.Cmd, chan error, *exec.Cmd, string, string) {
|
||||||
dir, err := ioutil.TempDir("", serverType+"-server-test"+suffix)
|
dir, err := ioutil.TempDir("", serverType+"-server-test"+suffix)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
|
@ -107,7 +107,7 @@ func startMediaAPI(suffix string, dynamicThumbnails bool) (*exec.Cmd, chan error
|
||||||
testDatabaseName + suffix,
|
testDatabaseName + suffix,
|
||||||
}
|
}
|
||||||
|
|
||||||
proxyCmd, proxyCmdChan := test.StartProxy(proxyAddr, cfg)
|
proxyCmd, _ := test.StartProxy(proxyAddr, cfg)
|
||||||
|
|
||||||
test.InitDatabase(
|
test.InitDatabase(
|
||||||
postgresDatabase,
|
postgresDatabase,
|
||||||
|
|
@ -121,7 +121,7 @@ func startMediaAPI(suffix string, dynamicThumbnails bool) (*exec.Cmd, chan error
|
||||||
)
|
)
|
||||||
|
|
||||||
fmt.Printf("==TESTSERVER== STARTED %v -> %v : %v\n", proxyAddr, cfg.Listen.MediaAPI, dir)
|
fmt.Printf("==TESTSERVER== STARTED %v -> %v : %v\n", proxyAddr, cfg.Listen.MediaAPI, dir)
|
||||||
return cmd, cmdChan, string(cfg.Listen.MediaAPI), proxyCmd, proxyCmdChan, proxyAddr, dir
|
return cmd, cmdChan, proxyCmd, proxyAddr, dir
|
||||||
}
|
}
|
||||||
|
|
||||||
func cleanUpServer(cmd *exec.Cmd, dir string) {
|
func cleanUpServer(cmd *exec.Cmd, dir string) {
|
||||||
|
|
@ -145,7 +145,7 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// create server1 with only pre-generated thumbnails allowed
|
// create server1 with only pre-generated thumbnails allowed
|
||||||
server1Cmd, server1CmdChan, _, server1ProxyCmd, _, server1ProxyAddr, server1Dir := startMediaAPI("1", false)
|
server1Cmd, server1CmdChan, server1ProxyCmd, server1ProxyAddr, server1Dir := startMediaAPI("1", false)
|
||||||
defer cleanUpServer(server1Cmd, server1Dir)
|
defer cleanUpServer(server1Cmd, server1Dir)
|
||||||
defer server1ProxyCmd.Process.Kill() // nolint: errcheck
|
defer server1ProxyCmd.Process.Kill() // nolint: errcheck
|
||||||
testDownload(server1ProxyAddr, server1ProxyAddr, "doesnotexist", 404, server1CmdChan)
|
testDownload(server1ProxyAddr, server1ProxyAddr, "doesnotexist", 404, server1CmdChan)
|
||||||
|
|
@ -162,7 +162,7 @@ func main() {
|
||||||
testThumbnail(64, 64, "crop", server1ProxyAddr, server1CmdChan)
|
testThumbnail(64, 64, "crop", server1ProxyAddr, server1CmdChan)
|
||||||
|
|
||||||
// create server2 with dynamic thumbnail generation
|
// create server2 with dynamic thumbnail generation
|
||||||
server2Cmd, server2CmdChan, _, server2ProxyCmd, _, server2ProxyAddr, server2Dir := startMediaAPI("2", true)
|
server2Cmd, server2CmdChan, server2ProxyCmd, server2ProxyAddr, server2Dir := startMediaAPI("2", true)
|
||||||
defer cleanUpServer(server2Cmd, server2Dir)
|
defer cleanUpServer(server2Cmd, server2Dir)
|
||||||
defer server2ProxyCmd.Process.Kill() // nolint: errcheck
|
defer server2ProxyCmd.Process.Kill() // nolint: errcheck
|
||||||
testDownload(server2ProxyAddr, server2ProxyAddr, "doesnotexist", 404, server2CmdChan)
|
testDownload(server2ProxyAddr, server2ProxyAddr, "doesnotexist", 404, server2CmdChan)
|
||||||
|
|
|
||||||
|
|
@ -28,10 +28,10 @@ import (
|
||||||
func GetEvent(
|
func GetEvent(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
request *gomatrixserverlib.FederationRequest,
|
request *gomatrixserverlib.FederationRequest,
|
||||||
cfg config.Dendrite,
|
_ config.Dendrite,
|
||||||
query api.RoomserverQueryAPI,
|
query api.RoomserverQueryAPI,
|
||||||
now time.Time,
|
_ time.Time,
|
||||||
keys gomatrixserverlib.KeyRing,
|
_ gomatrixserverlib.KeyRing,
|
||||||
eventID string,
|
eventID string,
|
||||||
) util.JSONResponse {
|
) util.JSONResponse {
|
||||||
var authResponse api.QueryServerAllowedToSeeEventResponse
|
var authResponse api.QueryServerAllowedToSeeEventResponse
|
||||||
|
|
|
||||||
|
|
@ -287,7 +287,7 @@ func buildMembershipEvent(
|
||||||
// them responded with an error.
|
// them responded with an error.
|
||||||
func sendToRemoteServer(
|
func sendToRemoteServer(
|
||||||
ctx context.Context, inv invite,
|
ctx context.Context, inv invite,
|
||||||
federation *gomatrixserverlib.FederationClient, cfg config.Dendrite,
|
federation *gomatrixserverlib.FederationClient, _ config.Dendrite,
|
||||||
builder gomatrixserverlib.EventBuilder,
|
builder gomatrixserverlib.EventBuilder,
|
||||||
) (err error) {
|
) (err error) {
|
||||||
remoteServers := make([]gomatrixserverlib.ServerName, 2)
|
remoteServers := make([]gomatrixserverlib.ServerName, 2)
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ func SelectThumbnail(desired types.ThumbnailSize, thumbnails []*types.ThumbnailM
|
||||||
}
|
}
|
||||||
|
|
||||||
// getActiveThumbnailGeneration checks for active thumbnail generation
|
// getActiveThumbnailGeneration checks for active thumbnail generation
|
||||||
func getActiveThumbnailGeneration(dst types.Path, config types.ThumbnailSize, activeThumbnailGeneration *types.ActiveThumbnailGeneration, maxThumbnailGenerators int, logger *log.Entry) (isActive bool, busy bool, errorReturn error) {
|
func getActiveThumbnailGeneration(dst types.Path, _ types.ThumbnailSize, activeThumbnailGeneration *types.ActiveThumbnailGeneration, maxThumbnailGenerators int, logger *log.Entry) (isActive bool, busy bool, errorReturn error) {
|
||||||
// Check if there is active thumbnail generation.
|
// Check if there is active thumbnail generation.
|
||||||
activeThumbnailGeneration.Lock()
|
activeThumbnailGeneration.Lock()
|
||||||
defer activeThumbnailGeneration.Unlock()
|
defer activeThumbnailGeneration.Unlock()
|
||||||
|
|
@ -119,7 +119,7 @@ func getActiveThumbnailGeneration(dst types.Path, config types.ThumbnailSize, ac
|
||||||
|
|
||||||
// broadcastGeneration broadcasts that thumbnail generation completed and the error to all waiting goroutines
|
// broadcastGeneration broadcasts that thumbnail generation completed and the error to all waiting goroutines
|
||||||
// Note: This should only be called by the owner of the activeThumbnailGenerationResult
|
// Note: This should only be called by the owner of the activeThumbnailGenerationResult
|
||||||
func broadcastGeneration(dst types.Path, activeThumbnailGeneration *types.ActiveThumbnailGeneration, config types.ThumbnailSize, errorReturn error, logger *log.Entry) {
|
func broadcastGeneration(dst types.Path, activeThumbnailGeneration *types.ActiveThumbnailGeneration, _ types.ThumbnailSize, errorReturn error, logger *log.Entry) {
|
||||||
activeThumbnailGeneration.Lock()
|
activeThumbnailGeneration.Lock()
|
||||||
defer activeThumbnailGeneration.Unlock()
|
defer activeThumbnailGeneration.Unlock()
|
||||||
if activeThumbnailGenerationResult, ok := activeThumbnailGeneration.PathToResult[string(dst)]; ok {
|
if activeThumbnailGenerationResult, ok := activeThumbnailGeneration.PathToResult[string(dst)]; ok {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue