From 9f1a4aaa9960fe3ab664033e1c1f42e62c3fb2e8 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 8 May 2024 09:31:32 +0200 Subject: fix: incorrect default/example values stored after processing --- internal/options/process.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'internal/options/process.go') diff --git a/internal/options/process.go b/internal/options/process.go index 32a76a2..4e7c664 100644 --- a/internal/options/process.go +++ b/internal/options/process.go @@ -26,9 +26,9 @@ type linkJSON struct { type nixOptionJSON struct { Declarations []linkJSON - Default nixValueJSON + Default *nixValueJSON Description string - Example nixValueJSON + Example *nixValueJSON Loc []string ReadOnly bool RelatedPackages string @@ -80,13 +80,12 @@ func MakeChannelLink(channel string, ref string, subPath string) (*Link, error) }, nil } -func convertNixValue(nj nixValueJSON) *NixValue { +func convertNixValue(nj *nixValueJSON) *NixValue { + if nj == nil { + return nil + } switch nj.Type { case "", "literalExpression": - if nj.Text == "" { - return nil - } - return &NixValue{ Text: nj.Text, } @@ -144,6 +143,8 @@ func Process(inpath string, outpath string, channel string, revision string) err var decls []*Link for _, decl := range x["declarations"].([]interface{}) { + optJSON = nixOptionJSON{} + switch decl := reflect.ValueOf(decl); decl.Kind() { case reflect.String: s := decl.String() -- cgit 1.4.1