refactor: pass experiment arguments using a struct (#983)

Closes https://github.com/ooni/probe/issues/2358.
This commit is contained in:
Simone Basso 2022-11-22 10:43:47 +01:00 committed by GitHub
commit a0dc65641d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
76 changed files with 824 additions and 481 deletions

View file

@ -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")
}
```

View file

@ -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")
}
// ```