Hello, my issue is similar to: 
https://stackoverflow.com/questions/38784963/exporting-functions-with-anonymous-struct-as-a-parameter-cannot-use-value-type

In this particular case, it is fixed by exporting the fields capitalizing 
the field name. But, what if the struct fields are also anonymous?

main.go:
----------------------------------------------------
package main

import "a/b"

func f(s struct{ byte }) {}

func main() {
s := struct{ byte }{}
f(s)   // This works
b.F(s) // This gives an argument type error
}
----------------------------------------------------

b/b.go:
----------------------------------------------------
package b

func F(c struct{ byte }) {
}
----------------------------------------------------

By building this code, we get the following compiler error:
`cannot use s (type struct { byte }) as type struct { byte } in argument to 
b.F`

In my opinion, it should be allowed to export the unnamed (anonymous) types 
so the struct can be used anywhere else. Opinions on 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/dcd6d246-4091-49da-8631-450829e6de68n%40googlegroups.com.

Reply via email to