Mercurial > gemma
diff pkg/models/intservices.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 | 9f7dc950ffd2 |
children | dfe9cde6a20c |
line wrap: on
line diff
--- a/pkg/models/intservices.go Sun Nov 25 10:51:54 2018 +0100 +++ b/pkg/models/intservices.go Sun Nov 25 15:56:07 2018 +0100 @@ -59,10 +59,11 @@ func (e *IntEntry) LoadStyle() (string, error) { var style string - err := auth.RunAs("sys_admin", context.Background(), + ctx := context.Background() + err := auth.RunAs(ctx, "sys_admin", func(conn *sql.Conn) error { return conn.QueryRowContext( - context.Background(), + ctx, selectStyleSQL, e.Name).Scan(&style) }) @@ -119,10 +120,11 @@ func (ps *IntServices) load() error { // make empty slice to prevent retry if slice is empty. ps.entries = []IntEntry{} - return auth.RunAs("sys_admin", context.Background(), + ctx := context.Background() + return auth.RunAs(ctx, "sys_admin", func(conn *sql.Conn) error { rows, err := conn.QueryContext( - context.Background(), selectServicesSQL) + ctx, selectServicesSQL) if err != nil { return err }