Re: [go-nuts] Re: How to import one field from package, etc

2020-09-23 Thread Jason Phillips
To answer the title question: no, there's no way to limit an imported package to a subset of its exported identifiers. But, given the example provided, it seems the suggested solution works exactly as you desire. You can give a local identifier to an imported package (e.g. https://play.golang.o

Re: [go-nuts] Re: How to import one field from package, etc

2020-09-23 Thread Alex Mills
It works temporarily, but then I have to manually update each file that imports + exports the methods, it won't "just work" with new versions of the library that gets imported, right? On Wed, Sep 23, 2020 at 11:59 AM Jason Phillips wrote: > Did you try your own suggestion? It seems to work fine

[go-nuts] Re: How to import one field from package, etc

2020-09-23 Thread Jason Phillips
Did you try your own suggestion? It seems to work fine: https://play.golang.org/p/KVo5COKj2ii On Wednesday, September 23, 2020 at 1:46:05 PM UTC-4 al...@channelmeter.com wrote: > Using node.js, we might have this: > > const z = new Z(); > exports.z = z > > and then in another file we can import