Golang source precompiled stuff

I’m new in golang so this is a newby question
I’m trying to find out if golang sources has some precompiled libraries/binaries/whatever which source code is not publicly available (still it can be under free license, but provided without sources - as is)
I walked across golang sources and found some *.a files in testdata folder (e.g. libimportsar.a)

So the questions are:

  1. What is libimportsar.a?
  2. Is there anything in golang source code which is provided ‘as is’ without sources? May be there are some non-opensource plugins (which can be used to shadow off the source code)?

Thanks in advance!

1 Like

That’s interesting; it looks like it’s only used in src/go/internal/gccgoimporter’s the test cases. I’m not sure if it’s source code is available anywhere; I can’t find it, but that doesn’t mean it’s not there!

You seem to be in conspiracy theory mode.

libimportsar.a is some test data.

go/internal/gccgoimporter: read export data from archives

When used with the go tool, gccgo will normally generate archive files.
This change teaches the gccgoimporter package how to read the export
data from an archive.

This is needed by, for example, cmd/vet, when typechecking packages.


Answer> In a nutshell, it is a library archive file for static links.
The Go language is a compiled language type`
Links that may be helpful





I don’t know how to open “a file”

Not that it matters, but my favorite “compiled type languages” are FORTRAN90, Go, and C.
Except for Go, I’m not good at linking libraries (lol).

Thanks you for your answers. The question about libimportsar.a was about content of the static library, but not the file type which is static lib

Referring to the second question. Do you know if golang uses precompiled stuff in some form? This can be static/dynamic libraries, plugins or anything else

You seem to be in conspiracy theory mode.

The thing is that heads of some companies want to know if they have the full sources of tools the company is using. It is sounds a bit paranoid, but as is :slight_smile:

I want to know that too. That’s why I use tools that I build from source on a clean machine.

For Go,

Installing Go from source.

Sources itself may include some precompiled data in some form, e.g. libimportsar.a
As go is a new programming language for me, I’m not sure about forms of code reusing practices. Go may contain it’s own precompiled formats and it is still possible to build from source. For the sake of building on different OSes it is possible to include the stuff for each OS. This is not a good practice, but still possible