So what's the maximum length for a Go identifier?
Actually this problem is quite odd. Trying to "go build" this program:
gives the following output:
name too long
So I created a small independent test program with a really really long
identifier name and its error message is different: "identifier too long".
(BTW would be *extreeemely* useful if this one and the above one both had
the format "identifier %s too long (has length %i, max is %i)" or some
such... most error messages throughout Go are great like that,
unfortunately these two aren't).
Also I should note that "go build" for the package being imported
(SVG.xsd_go) raises no issues about too-long identifiers (or names), and
creates the .a package just fine. I can also import that one into other
non-main packages and have *their* .a packages built just fine. Only when
finally attempting to use any such package in a main package for an
executable does this problem occur, I guess it's only then that "real
linking" of various .a's occurs.
As for said SVG package, this problem only started occurring when go-xsd
added support to add a Walk() method to any generated type, plus a
potentially quite "big" single struct var called W, starting (currently) at
In auto-generated code you end up with some pretty weird combined
identifier names, so would be reaaally useful to know what kinds of limits
exist. The Go Spec says zilch about this, sadly. At least in the
"identifiers" section I was consulting. WIP I guess? I expect to find such
things in a spec document... ;)
I was also using the search function at golang.org looking for "name too
long". Ignoring the matches for gob/decode, dnsclient_unix and zerrors, the
other matches where in the linked-related packages (5l/6l/8l). That message
is being produced when a call to some "Blinelen" function returns a value >
0, but I couldn't find said function's definition with golang.org search,
so suppose it's a C func somewhere way deep in the compiler code-base...
So what are my options? If any of the identifiers in SVG.xsd.go are too
long, why wouldn't the compile stage complain with "identifier too long"
(rather than link stage with "name too long"), as it does when I just
experimentally manually add a simple way-too-long identifier?