Merge pull request #2 from wneessen/remove-redundant-get
Some checks failed
Codecov workflow / run (push) Failing after 3s
golangci-lint / lint (push) Failing after 3s
REUSE Compliance Check / test (push) Failing after 2s

Remove redundant Get() method
This commit is contained in:
Winni Neessen 2024-09-01 21:17:50 +02:00 committed by GitHub
commit 25913bbf9f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 0 additions and 41 deletions

View file

@ -19,11 +19,6 @@ func (v *Variable[T]) Value() T {
return v.value return v.value
} }
// Get is an alias method for Value()
func (v *Variable[T]) Get() T {
return v.Value()
}
// NotNil returns true when a Variable is not nil // NotNil returns true when a Variable is not nil
func (v *Variable[T]) NotNil() bool { func (v *Variable[T]) NotNil() bool {
return v.notNil return v.notNil

View file

@ -49,9 +49,6 @@ func TestVariable_UnmarshalJSON_Boolean(t *testing.T) {
if !jt.Value.Value() { if !jt.Value.Value() {
t.Errorf("expected value to be true, got %t", jt.Value.Value()) t.Errorf("expected value to be true, got %t", jt.Value.Value())
} }
if !jt.Value.Get() {
t.Errorf("expected value to be true, got %t", jt.Value.Get())
}
jt.Value.Reset() jt.Value.Reset()
if jt.Value.NotNil() { if jt.Value.NotNil() {
@ -79,9 +76,6 @@ func TestVariable_UnmarshalJSON_ByteSlice(t *testing.T) {
if !bytes.Equal(jt.Value.Value(), []byte("bytes")) { if !bytes.Equal(jt.Value.Value(), []byte("bytes")) {
t.Errorf("expected value to be %q, got %q", "bytes", jt.Value.Value()) t.Errorf("expected value to be %q, got %q", "bytes", jt.Value.Value())
} }
if !bytes.Equal(jt.Value.Get(), []byte("bytes")) {
t.Errorf("expected value to be %q, got %q", "bytes", jt.Value.Get())
}
jt.Value.Reset() jt.Value.Reset()
if jt.Value.NotNil() { if jt.Value.NotNil() {
@ -110,9 +104,6 @@ func TestVariable_UnmarshalJSON_Float32(t *testing.T) {
if jt.Value.Value() != expected { if jt.Value.Value() != expected {
t.Errorf("expected value to be %f, got %f", expected, jt.Value.Value()) t.Errorf("expected value to be %f, got %f", expected, jt.Value.Value())
} }
if jt.Value.Get() != expected {
t.Errorf("expected value to be %f, got %f", expected, jt.Value.Get())
}
jt.Value.Reset() jt.Value.Reset()
if jt.Value.NotNil() { if jt.Value.NotNil() {
@ -141,9 +132,6 @@ func TestVariable_UnmarshalJSON_Float64(t *testing.T) {
if jt.Value.Value() != expected { if jt.Value.Value() != expected {
t.Errorf("expected value to be %f, got %f", expected, jt.Value.Value()) t.Errorf("expected value to be %f, got %f", expected, jt.Value.Value())
} }
if jt.Value.Get() != expected {
t.Errorf("expected value to be %f, got %f", expected, jt.Value.Get())
}
jt.Value.Reset() jt.Value.Reset()
if jt.Value.NotNil() { if jt.Value.NotNil() {
@ -172,9 +160,6 @@ func TestVariable_UnmarshalJSON_Int(t *testing.T) {
if jt.Value.Value() != expected { if jt.Value.Value() != expected {
t.Errorf("expected value to be %d, got %d", expected, jt.Value.Value()) t.Errorf("expected value to be %d, got %d", expected, jt.Value.Value())
} }
if jt.Value.Get() != expected {
t.Errorf("expected value to be %d, got %d", expected, jt.Value.Get())
}
jt.Value.Reset() jt.Value.Reset()
if jt.Value.NotNil() { if jt.Value.NotNil() {
@ -203,9 +188,6 @@ func TestVariable_UnmarshalJSON_Int64(t *testing.T) {
if jt.Value.Value() != expected { if jt.Value.Value() != expected {
t.Errorf("expected value to be %d, got %d", expected, jt.Value.Value()) t.Errorf("expected value to be %d, got %d", expected, jt.Value.Value())
} }
if jt.Value.Get() != expected {
t.Errorf("expected value to be %d, got %d", expected, jt.Value.Get())
}
jt.Value.Reset() jt.Value.Reset()
if jt.Value.NotNil() { if jt.Value.NotNil() {
@ -234,9 +216,6 @@ func TestVariable_UnmarshalJSON_String(t *testing.T) {
if jt.Value.Value() != expected { if jt.Value.Value() != expected {
t.Errorf("expected value to be %s, got %s", expected, jt.Value.Value()) t.Errorf("expected value to be %s, got %s", expected, jt.Value.Value())
} }
if jt.Value.Get() != expected {
t.Errorf("expected value to be %s, got %s", expected, jt.Value.Get())
}
jt.Value.Reset() jt.Value.Reset()
if jt.Value.NotNil() { if jt.Value.NotNil() {
@ -265,9 +244,6 @@ func TestVariable_UnmarshalJSON_UInt(t *testing.T) {
if jt.Value.Value() != expected { if jt.Value.Value() != expected {
t.Errorf("expected value to be %d, got %d", expected, jt.Value.Value()) t.Errorf("expected value to be %d, got %d", expected, jt.Value.Value())
} }
if jt.Value.Get() != expected {
t.Errorf("expected value to be %d, got %d", expected, jt.Value.Get())
}
jt.Value.Reset() jt.Value.Reset()
if jt.Value.NotNil() { if jt.Value.NotNil() {
@ -296,9 +272,6 @@ func TestVariable_UnmarshalJSON_UInt8(t *testing.T) {
if jt.Value.Value() != expected { if jt.Value.Value() != expected {
t.Errorf("expected value to be %d, got %d", expected, jt.Value.Value()) t.Errorf("expected value to be %d, got %d", expected, jt.Value.Value())
} }
if jt.Value.Get() != expected {
t.Errorf("expected value to be %d, got %d", expected, jt.Value.Get())
}
jt.Value.Reset() jt.Value.Reset()
if jt.Value.NotNil() { if jt.Value.NotNil() {
@ -327,9 +300,6 @@ func TestVariable_UnmarshalJSON_UInt16(t *testing.T) {
if jt.Value.Value() != expected { if jt.Value.Value() != expected {
t.Errorf("expected value to be %d, got %d", expected, jt.Value.Value()) t.Errorf("expected value to be %d, got %d", expected, jt.Value.Value())
} }
if jt.Value.Get() != expected {
t.Errorf("expected value to be %d, got %d", expected, jt.Value.Get())
}
jt.Value.Reset() jt.Value.Reset()
if jt.Value.NotNil() { if jt.Value.NotNil() {
@ -358,9 +328,6 @@ func TestVariable_UnmarshalJSON_UInt32(t *testing.T) {
if jt.Value.Value() != expected { if jt.Value.Value() != expected {
t.Errorf("expected value to be %d, got %d", expected, jt.Value.Value()) t.Errorf("expected value to be %d, got %d", expected, jt.Value.Value())
} }
if jt.Value.Get() != expected {
t.Errorf("expected value to be %d, got %d", expected, jt.Value.Get())
}
jt.Value.Reset() jt.Value.Reset()
if jt.Value.NotNil() { if jt.Value.NotNil() {
@ -389,9 +356,6 @@ func TestVariable_UnmarshalJSON_UInt64(t *testing.T) {
if jt.Value.Value() != expected { if jt.Value.Value() != expected {
t.Errorf("expected value to be %d, got %d", expected, jt.Value.Value()) t.Errorf("expected value to be %d, got %d", expected, jt.Value.Value())
} }
if jt.Value.Get() != expected {
t.Errorf("expected value to be %d, got %d", expected, jt.Value.Get())
}
jt.Value.Reset() jt.Value.Reset()
if jt.Value.NotNil() { if jt.Value.NotNil() {