aboutsummaryrefslogtreecommitdiff
path: root/cmd/internal
diff options
context:
space:
mode:
authorJonathan Amsterdam <jba@google.com>2020-10-07 08:09:54 -0400
committerJonathan Amsterdam <jba@google.com>2020-10-07 15:22:58 +0000
commit2013d733d2d85c6660f66a7ee160a18f80ed79c3 (patch)
treeabec96bf1adf3b240481c8b04960427b6985e3e1 /cmd/internal
parentdcfab7849fe4cd00bdaa9fce0a02afc81abb937f (diff)
downloadgo-x-pkgsite-2013d733d2d85c6660f66a7ee160a18f80ed79c3.tar.xz
cmd/internal/cmdconfig: fill in experiment descriptions
If an experiment lacks a description in the config file, use the description from internal.Experiments. Log an error if the experiment name is not in that map. Change-Id: I3362d9a71d963a202d1616b9f2c6cf347314332c Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/260117 Trust: Jonathan Amsterdam <jba@google.com> Run-TryBot: Jonathan Amsterdam <jba@google.com> Reviewed-by: Jamal Carvalho <jamal@golang.org>
Diffstat (limited to 'cmd/internal')
-rw-r--r--cmd/internal/cmdconfig/cmdconfig.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/cmd/internal/cmdconfig/cmdconfig.go b/cmd/internal/cmdconfig/cmdconfig.go
index 983e7b40..af9f406c 100644
--- a/cmd/internal/cmdconfig/cmdconfig.go
+++ b/cmd/internal/cmdconfig/cmdconfig.go
@@ -73,9 +73,15 @@ func ExperimentGetter(ctx context.Context, cfg *config.Config) middleware.Experi
var s []string
for _, e := range dc.Experiments {
s = append(s, fmt.Sprintf("%s:%d", e.Name, e.Rollout))
+ if desc, ok := internal.Experiments[e.Name]; ok {
+ if e.Description == "" {
+ e.Description = desc
+ }
+ } else {
+ log.Errorf(ctx, "unknown experiment %q", e.Name)
+ }
}
log.Infof(ctx, "read experiments %s", strings.Join(s, ", "))
-
return dc.Experiments, nil
}
}