Can we create binaries for a package in golang

Suppose If we create a package in golang we have host it on GitHub so that user can download it using go get github.com/package.

I have seen most of the people hosting their source code under the GitHub account.
Can we put binary instead of source code?
Is it possible to create a binary for the package?

Thanks,
Akhil

1 Like

According to the documenation, binary-only packages are no longer supported since 1.12.

1 Like

Thanks @NobbZ
So that means we cannot release a package without source code.

1 Like

Yes.

1 Like

If you’re on Github, you can try out https://github.com/goreleaser/goreleaser. It helps packaging your binary into OS oriented release packages. However, that will be separated from go get a binary.

1 Like

Thanks @hollowaykeanho

1 Like

It seems I originally missunderstood your question… I was under the impression that this question was about library packages, not executables.

Executables of course can be distributed after compilation and usually do not require anything to be installed on the target system except for a libc…

1 Like

@NobbZ you understood it in the right way. I posted it to know we can create binaries for a package.
But @hollowaykeanho post helped me for other thing.

1 Like

Did we solved your question? If it does, feel free to “mark as solved”. Please Mark @NobbZ first reply as that is the right answer.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.