Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
f723bf08
Commit
f723bf08
authored
Aug 17, 2023
by
Michael Yang
Browse files
ignore nil map values
parent
cbf725a9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
0 deletions
+4
-0
api/types.go
api/types.go
+4
-0
No files found.
api/types.go
View file @
f723bf08
...
...
@@ -216,6 +216,10 @@ func (opts *Options) FromMap(m map[string]interface{}) error {
if
opt
,
ok
:=
jsonOpts
[
key
];
ok
{
field
:=
valueOpts
.
FieldByName
(
opt
.
Name
)
if
field
.
IsValid
()
&&
field
.
CanSet
()
{
if
val
==
nil
{
continue
}
switch
field
.
Kind
()
{
case
reflect
.
Int
:
switch
t
:=
val
.
(
type
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment