refactor: pass experiment arguments using a struct (#983)
Closes https://github.com/ooni/probe/issues/2358.
This commit is contained in:
parent
c2ea0b4704
commit
a0dc65641d
76 changed files with 824 additions and 481 deletions
|
|
@ -211,7 +211,12 @@ need any fancy context and we pass a `context.Background` to `Run`.
|
|||
|
||||
```Go
|
||||
ctx := context.Background()
|
||||
if err = m.Run(ctx, sess, measurement, callbacks); err != nil {
|
||||
args := &model.ExperimentArgs{
|
||||
Callbacks: callbacks,
|
||||
Measurement: measurement,
|
||||
Session: sess,
|
||||
}
|
||||
if err = m.Run(ctx, args); err != nil {
|
||||
log.WithError(err).Fatal("torsf experiment failed")
|
||||
}
|
||||
```
|
||||
|
|
|
|||
|
|
@ -212,7 +212,12 @@ func main() {
|
|||
//
|
||||
// ```Go
|
||||
ctx := context.Background()
|
||||
if err = m.Run(ctx, sess, measurement, callbacks); err != nil {
|
||||
args := &model.ExperimentArgs{
|
||||
Callbacks: callbacks,
|
||||
Measurement: measurement,
|
||||
Session: sess,
|
||||
}
|
||||
if err = m.Run(ctx, args); err != nil {
|
||||
log.WithError(err).Fatal("torsf experiment failed")
|
||||
}
|
||||
// ```
|
||||
|
|
|
|||
Loading…
Reference in a new issue