summaryrefslogtreecommitdiff
path: root/lib/containers/optional.go
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2023-03-17 02:28:54 -0400
committerLuke Shumaker <lukeshu@lukeshu.com>2023-03-17 02:52:07 -0400
commit1ea26f04701fa66e36b058f3efb3a6c7059cdc5c (patch)
tree9ba66e893d6f66096f6b06284d09c8eb3e50facc /lib/containers/optional.go
parent0cfc5d80855ee0a28329305cda13e7bff935a297 (diff)
tree-wide: Turn on all revive linters (with exceptions)
Diffstat (limited to 'lib/containers/optional.go')
-rw-r--r--lib/containers/optional.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/containers/optional.go b/lib/containers/optional.go
index c0e7b32..5bb7bb6 100644
--- a/lib/containers/optional.go
+++ b/lib/containers/optional.go
@@ -1,4 +1,4 @@
-// Copyright (C) 2022 Luke Shumaker <lukeshu@lukeshu.com>
+// Copyright (C) 2022-2023 Luke Shumaker <lukeshu@lukeshu.com>
//
// SPDX-License-Identifier: GPL-2.0-or-later
@@ -19,11 +19,10 @@ var (
)
func (o Optional[T]) MarshalJSON() ([]byte, error) {
- if o.OK {
- return json.Marshal(o.Val)
- } else {
+ if !o.OK {
return []byte("null"), nil
}
+ return json.Marshal(o.Val)
}
func (o *Optional[T]) UnmarshalJSON(dat []byte) error {