Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
fmt: Printf not respecting String() method of elements of a struct #17409
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
If there are no arguments against i think this can be closed.
That the String method of an unexported field can not be called in another package is normal behavior and fmt is another package. In general e.g. somestruct.someunexportedfield.String() is not directly callable in another package.
It is possible to define a String method on Box that has access to elem and then hands this over to fmt directly to allow for the unexported fields String method to be called: