Consuming the Go binding now requires downloading the tarball, and
copying the source to your project. This is not the standard way that Go
modules should be consumed.
We can solve this issue in several ways:
- Publish the Go module from the libnbd repo
- Publish the Go module from a new distribution repo
- Publish the Go module via a proxy server
The first option requires that we keep the generated sources in the
repo, and change the package name to it can be imported from the gitlab
subdirectory:
import "gitlab.com/nbdkit/libnbd/-/tree/master/golang"
Since the Go tools do not support yet a module in a sub-directory of a
git repo:
https://github.com/golang/go/issues/34055
I think this is horrible.
The second option requires that we push the Go binding source to a new
repo:
https://gitlab.com/nbdkit/libnbd-golang
I think this may confuse users and will be harder to maintain.
The third option seems most suitable for libnbd use case - serve the Go
module from the same server serving the tarballs. This requires creating
a module zip file, and uploading it to a special directory structure on
the web server, with some metadata files.
For the second and third options, we can keep the name of the module as
"libguestfs.org/libnb" by serving html document with the required meta
tag at:
https://libguestfs.org/libnbd
This series implement the third option by adding a script to create the
distribution tree for the web server.
Nir Soffer (2):
golang: Create distribution for a proxy server
golang/README.md: Remove the hacks
golang/README.md | 31 -----------
golang/make-dist.sh | 123 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 123 insertions(+), 31 deletions(-)
create mode 100755 golang/make-dist.sh
--
2.31.1