Golang source precompiled stuff

Hello,
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.

src/go/internal/gccgoimporter/testdata/libimportsar.a[Added]

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

**


https://kanonji.hatenadiary.com/entry/20121018/1350538932

https://www.it-swarm-ja.tech/ja/c/%E6%8B%A1%E5%BC%B5%E5%AD%90%E3%81%8Ca%E3%81%AE%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E3%81%A8%E3%81%AF%E4%BD%95%E3%81%A7%E3%81%99%E3%81%8B%EF%BC%9F/973170683/#:~:text=a%20%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E3%81%AF%20%E9%9D%99%E7%9A%84,%E3%83%A9%E3%82%A4%E3%83%96%E3%83%A9%E3%83%AA%E3%81%AB%E3%83%AA%E3%83%B3%E3%82%AF%E3%81%97%E3%81%BE%E3%81%99%E3%80%82&text=05%2F11%20GWW-,.,%E3%81%A7%E4%BD%9C%E6%88%90%E3%81%95%E3%82%8C%E3%80%81%E3%83%A9%E3%82%A4%E3%83%96%E3%83%A9%E3%83%AA%E3%81%A7%E3%81%99%E3%80%82

**

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

Blockquote
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