I have a pretty big structure, which until I created an instance with struct literal syntax, for example:
Thing{ "the name", ... }
I just added unallocated field in the structure Thing, and now Go complains implicit assignment of unexported field 'config' in Thing literal.
Thing
implicit assignment of unexported field 'config' in Thing literal
Is it possible to continue using the literal syntax, although now there is an unpacked field in the structure?
, , , , ( /).
, :
t := Thing{ Name: "the name", someUnexported: 23, }
, , , :
t := otherpackage.Thing{ Name: "the name", // someUnexported will implicitly be its zero value }
, , , - ( setter), (), / .
. : ?
. , :
t := Thing { Name: "the name", // <-- This will work because Name start with capital letter someUnexported: 23, // <-- this wont work because someUnexported starts with small letter }
Source: https://habr.com/ru/post/1681867/More articles:Query to check for elements in a partition group - sqlSKAction resumes when appDidBecomeActive () even when the game pauses until appDidResignActive () - iosThe impact of the dose regimen Android - androidSuspend SpriteKit - UIApplicationWillResignActive vs. UIApplicationDidBecomeActive? - iosAvoid the cumulative 16 MB limit - node.jsKotlin - Waiting Function - waitВызвать метод GameScene из AppDelegate (Swift 3, SpriteKit, Xcode 8) - iosAndroid and foreground dose mode - androidReturn row data from a table with a specified row without looping through all rows - google-spreadsheethow to make a large figure in a cell of a Jupyter laptop, scrollable when it is displayed in html - htmlAll Articles