Make library out of cmd/pack code

150 views
Skip to first unread message

apel...@google.com

unread,
Jun 28, 2016, 1:43:07 PM6/28/16
to golang-dev, Girish Kalele
Hi,

In order to fix an issue in github.com/nsf/gocode, I had to borrow the ar-parsing code from cmd/pack [1]. Would it make sense to have this code available as a library rather than hidden in a cmd?

Thanks,
Antoine

Ian Lance Taylor

unread,
Jun 28, 2016, 1:48:51 PM6/28/16
to apel...@google.com, golang-dev, Girish Kalele
On Tue, Jun 28, 2016 at 10:21 AM, apelisse via golang-dev
<golan...@googlegroups.com> wrote:
>
> In order to fix an issue in github.com/nsf/gocode, I had to borrow the
> ar-parsing code from cmd/pack [1]. Would it make sense to have this code
> available as a library rather than hidden in a cmd?

In principle, sure, but this may be affected by
https://golang.org/issue/14386. That is, the archive format is not
fixed and it is likely premature to create a library for it.

Ian

Antoine Pelisse

unread,
Jun 28, 2016, 1:54:04 PM6/28/16
to Ian Lance Taylor, golang-dev, Girish Kalele
I would have said the opposite? If we have a good interface/abstraction, we can make whatever changes we want without impacting users. It would be transparent.
Right now they have to hack their way into the .a file, and any change to its format breaks everybody's code

But sure, if the format is not definitive, then it's probably impossible to create a proper interface/abstraction.

Antoine

Matthew Dempsky

unread,
Jun 28, 2016, 1:57:50 PM6/28/16
to Antoine Pelisse, Ian Lance Taylor, golang-dev, Girish Kalele
On Tue, Jun 28, 2016 at 10:53 AM, 'Antoine Pelisse' via golang-dev <golan...@googlegroups.com> wrote:
I would have said the opposite? If we have a good interface/abstraction, we can make whatever changes we want without impacting users. It would be transparent.
Right now they have to hack their way into the .a file, and any change to its format breaks everybody's code

Most users shouldn't need to manually inspect .a files anyway.  E.g., gocode wouldn't need to if it used the standard library's go/importer API.  (See github.com/mdempsky/gocode for my fork that does exactly this.)

Antoine Pelisse

unread,
Jun 28, 2016, 2:07:03 PM6/28/16
to Matthew Dempsky, Ian Lance Taylor, golang-dev, Girish Kalele
Yeah that sounds reasonable to me. Thanks! 
Reply all
Reply to author
Forward
0 new messages