diff pkg/controllers/pwreset.go @ 1327:cabf4789e02b

To make golint happier made context.Context to be the first argument of auth.RunAs.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Sun, 25 Nov 2018 15:56:07 +0100
parents 5443f5c9154c
children ed4820efb7e6
line wrap: on
line diff
--- a/pkg/controllers/pwreset.go	Sun Nov 25 10:51:54 2018 +0100
+++ b/pkg/controllers/pwreset.go	Sun Nov 25 15:56:07 2018 +0100
@@ -122,12 +122,13 @@
 	config.WaitReady()
 	for {
 		time.Sleep(cleanupPause)
+		ctx := context.Background()
 		err := auth.RunAs(
-			pwResetRole, context.Background(),
+			ctx, pwResetRole,
 			func(conn *sql.Conn) error {
 				good := time.Now().Add(-passwordResetValid)
 				_, err := conn.ExecContext(
-					context.Background(), cleanupRequestsSQL, good)
+					ctx, cleanupRequestsSQL, good)
 				return err
 			})
 		if err != nil {
@@ -208,7 +209,7 @@
 	ctx := context.Background()
 
 	if err := auth.RunAs(
-		pwResetRole, ctx,
+		ctx, pwResetRole,
 		func(conn *sql.Conn) error {
 
 			var count int64
@@ -304,7 +305,7 @@
 	ctx := req.Context()
 
 	if err = auth.RunAs(
-		pwResetRole, ctx, func(conn *sql.Conn) error {
+		ctx, pwResetRole, func(conn *sql.Conn) error {
 			err := conn.QueryRowContext(ctx, findRequestSQL, hash).Scan(&email, &user)
 			switch {
 			case err == sql.ErrNoRows: