I have a struct:
package df
type SortKey struct {
Key interface{}
SortDesc bool
seriesIndex int
}
From an outside package:
TRY 1
z := df.SortKey{"n", false}
Compiler error: too few values in df.SortKey literal
TRY 2
z := df.SortKey{"n", false, 0}
Compiler error: implicit assignment of unexported field 'seriesIndex' in df.SortKey literal
You can't win. Perhaps it should just be disallowed for Go 2 - It messes up backwards compatibility anyway amongst minor versions of packages (eg. net/http.Request and Context situation).
I have a struct:
From an outside package:
TRY 1
Compiler error: too few values in df.SortKey literalTRY 2
Compiler error: implicit assignment of unexported field 'seriesIndex' in df.SortKey literalYou can't win. Perhaps it should just be disallowed for Go 2 - It messes up backwards compatibility anyway amongst minor versions of packages (eg. net/http.Request and Context situation).