Changeset 652 in code for trunk/cmd/sojuctl/main.go


Ignore:
Timestamp:
Oct 18, 2021, 5:15:15 PM (4 years ago)
Author:
contact
Message:

Add context args to Database interface

This is a mecanical change, which just lifts up the context.TODO()
calls from inside the DB implementations to the callers.

Future work involves properly wiring up the contexts when it makes
sense.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/cmd/sojuctl/main.go

    r620 r652  
    33import (
    44        "bufio"
     5        "context"
    56        "flag"
    67        "fmt"
     
    7677                        Admin:    *admin,
    7778                }
    78                 if err := db.StoreUser(&user); err != nil {
     79                if err := db.StoreUser(context.TODO(), &user); err != nil {
    7980                        log.Fatalf("failed to create user: %v", err)
    8081                }
     
    8687                }
    8788
    88                 user, err := db.GetUser(username)
     89                user, err := db.GetUser(context.TODO(), username)
    8990                if err != nil {
    9091                        log.Fatalf("failed to get user: %v", err)
     
    102103
    103104                user.Password = string(hashed)
    104                 if err := db.StoreUser(user); err != nil {
     105                if err := db.StoreUser(context.TODO(), user); err != nil {
    105106                        log.Fatalf("failed to update password: %v", err)
    106107                }
Note: See TracChangeset for help on using the changeset viewer.