How to create assembly for vendor (Third party lib) in golang


(shubham jain) #1

Please help.

ASAP.


(Norbert Melzer) #2

Please ask an actual question.

Thank you for your patience.


(shubham jain) #3

can we create assembly file for vendor


(Johan Dahl) #4

Assemblies doesn’t really exist in Go they are a dot net thing. But you want to create a library? The common way is to put on for example GitHub and then import it into Go.


(shubham jain) #5

Thanks, johandalabacka for fast reply
can we create “any binary” file for vendor (Third party lib), so that we can avoid commit code in cvs for vendor source code.


(Johan Dahl) #6

The new version to do it is using modules in Go 10.11

Then you only reference the third party libraries in your code and it is stored and build in another folder.


(Norbert Melzer) #7

I still don’t get (fully) what you actually want…

So let me try to ask around a bit to better learn what you want, or even discover what you really need.

From what I got in this thread so far, it seems as if you want to produce some shared objects, DLL, dynamically linked library or even a statically linked linrary, that you can share independently from your program.

Do you want to do this for some third party code which you are not allowed to publish the sourcecode of or do you want to create a library that you share in object form only without providing the sources?


(shubham jain) #8

@NobbZ Norbert Melzer Please help me fast, if you know the solution??

I need to commit code in my repository. so there are some question.

  1. need to commit full code with vendor source file (third party lib) ? [My project + vendor source file]
    or
  2. need to commit full code with vendor binary file (third party lib) ?[My project + vendor binary file]

if 2 is to followed, how to create binary or compile vendor source file.

in another word, how to make build like in java (maven, gradle), is there any way to do this.

What is build management system in golang.


(Norbert Melzer) #9

If you use go 1.11, modules are the way to go as @johandalabacka already said in his response.

If you use an older version of go, you simply can import the third party packages and doing go get ./... in your project prior to building it, should download all dependencies. It has the risk of breaking API changes though.

Thats why you can also copy the packages sources in a vendor folder,but beware the original packages folder hirarchy. Many simply copy the source code of the dependency, I tend to use git submodules, because its easier to update then.


(Robert Sung Wook Shin) #10

I guess that @NobbZ’s second response is what you want.

Go suppoprt to build your code as shared library.


(Robert Sung Wook Shin) #11

Maybe your question means that you want make cloaking your source code so, although it is not a test for creating assembly or Java byte code, I tried some test about shared library anyway.

It seems that calling shared libraries from golang to golang is much hard, and not possible on windows.
Perhaps you should call your go function from other language.

Could you check below link?

If not from golang, it seems possible and not hard to call function which is created using golang from almost languages.