1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2026-01-08 17:51:57 +00:00

config: Tidy default handling and comparisons in tests

This patch tidies how defaults are handled in the config, using a new
logic to allow "overriding" one config (the default) with another (the
user supplied).

It also improves how the comparisons are done in the tests, using the
more convenient "github.com/google/go-cmp/cmp" package, which also
prints nice diffs on errors.

This is in preparation for a future path where the override mechanism
will be reused.
This commit is contained in:
Alberto Bertogli
2020-05-16 23:48:09 +01:00
parent b1fe4f81f9
commit 7909b479eb
3 changed files with 115 additions and 75 deletions

1
go.mod
View File

@@ -8,6 +8,7 @@ require (
blitiri.com.ar/go/systemd v0.0.0-20171003041308-cdc4fd023aa4
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815
github.com/golang/protobuf v1.4.0
github.com/google/go-cmp v0.4.0
golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e
golang.org/x/text v0.3.2