summaryrefslogtreecommitdiff
path: root/pkg/values.go
diff options
context:
space:
mode:
authorJulien Dessaux2024-06-02 01:17:36 +0200
committerJulien Dessaux2024-06-02 01:17:36 +0200
commit4a254746de7246ddf8ac131f734f224d49e927b7 (patch)
treee7b33fb7769864ed7528ae9fe1f59a6a61012351 /pkg/values.go
parentfix(gonf): fixed hostflag management (diff)
downloadgonf-4a254746de7246ddf8ac131f734f224d49e927b7.tar.gz
gonf-4a254746de7246ddf8ac131f734f224d49e927b7.tar.bz2
gonf-4a254746de7246ddf8ac131f734f224d49e927b7.zip
chore(gonf): removed opinionated static checkers
Diffstat (limited to '')
-rw-r--r--pkg/values.go17
1 files changed, 8 insertions, 9 deletions
diff --git a/pkg/values.go b/pkg/values.go
index 70fc9fe..c85de01 100644
--- a/pkg/values.go
+++ b/pkg/values.go
@@ -14,20 +14,19 @@ type Value interface {
}
func interfaceToValue(v any) Value {
- if vv, ok := v.([]byte); ok {
+ switch vv := v.(type) {
+ case []byte:
return &BytesValue{vv}
- }
- if vv, ok := v.(int); ok {
+ case int:
return &IntValue{vv}
- }
- if vv, ok := v.(string); ok {
+ case string:
return &StringValue{vv}
- }
- if vv, ok := v.(*VariablePromise); ok {
+ case *VariablePromise:
return vv
+ default:
+ slog.Error("interfaceToValue", "value", v, "error", "Not Implemented")
+ panic(fmt.Sprintf("interfaceToValue cannot take type %T as argument. Value was %#v.", v, v))
}
- slog.Error("interfaceToValue", "value", v, "error", "Not Implemented")
- panic(fmt.Sprintf("interfaceToValue cannot take type %T as argument. Value was %#v.", v, v))
}
func interfaceToTemplateValue(v any) Value {