refactor: make measurex depend on measurexlite (#892)

This diff makes `measurex` depend on `measurexlite` rather than the other way around.

While there, add unit tests.

Closes https://github.com/ooni/probe/issues/2240
This commit is contained in:
Simone Basso 2022-08-28 21:41:58 +02:00 committed by GitHub
commit 8ca7645026
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 312 additions and 71 deletions

View file

@ -1,12 +1,6 @@
package measurex
// NewFailure creates a serializable failure from an error. We
// cannot round trip an error using JSON, so we serialize to this
// intermediate format that is a sort of Optional<string>.
func NewFailure(err error) *string {
if err == nil {
return nil
}
s := err.Error()
return &s
}
import "github.com/ooni/probe-cli/v3/internal/measurexlite"
// NewFailure is an alias for measurexlite.NewFailure
var NewFailure = measurexlite.NewFailure