Thanks for the assistance. Issue resolved by naming "width" and "height"
with the capital starting letter, "Width" and "Height". Looks like I'm
still not familiar with the Go export syntax yet.

Harris, Andrew <harris...@spu.edu> 于2022年8月31日周三 06:07写道:

> I believe anonymous definitions of structs here is the cause. While
> equivalent, each anonymous definition is a distinct type.
>
> Get Outlook for iOS <https://aka.ms/o0ukef>
> ------------------------------
> *From:* golang-nuts@googlegroups.com <golang-nuts@googlegroups.com> on
> behalf of Richard Whatever <c.richard.w...@gmail.com>
> *Sent:* Tuesday, August 30, 2022 7:46:47 AM
> *To:* golang-nuts <golang-nuts@googlegroups.com>
> *Subject:* [go-nuts] How to resolve error Cannot use 'struct{ width,
> height float64 }{2.0, 3.0}' (type struct {...}) as the type struct {...}
>
>
> I'm developing a mvc Golang server.
>
> The model file is as follows:
> type Object struct { ... TargetSize struct{ width, height float64 }
> `json:"targetSize"` ... }
>
> The controller file is as follows:
> func (c *GetObject) Get() []models.Object { return []models.Object{ {...
> struct{ width, height float64 }{2.0, 3.0}, ... },
>
> I keep on getting the error of "Cannot use 'struct{ width, height float64
> }{2.0, 3.0}' (type struct {...}) as the type struct {...}" and I don't know
> how to resolve this.
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/a6b7d86c-8ed6-4be1-a265-3761f3b8be67n%40googlegroups.com
> <https://groups.google.com/d/msgid/golang-nuts/a6b7d86c-8ed6-4be1-a265-3761f3b8be67n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAKS_JOh5FWwmnV8q-ECsn%3DyL7BV5fO78ZwVkPMBoSCi8itr%2B7w%40mail.gmail.com.

Reply via email to