This change fixes some of the problems (missing go.mod, license, readme)
But this page expects the package name:
import "github.com/libguestfs/libnbd/golang"
But we use:
import "libguestfs.org/libnbd"
This issue can be solve by returning the right metadata at:
But turns out that the go proxy protocol does *not* support modules which
are not at the root of the repo:
This is not enough to consume the module directly from the source,
we
still have to solve the issue of the generated files, and returning the
right metadata from
https://libguestfs.org/libnbd.
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
generator/generator.ml | 12 +--
.../libguestfs.org/libnbd => }/.gitignore | 0
.../{src/libguestfs.org/libnbd => }/LICENSE | 0
golang/Makefile.am | 83 +++++++++----------
.../{src/libguestfs.org/libnbd => }/README.md | 17 ++--
.../libguestfs.org/libnbd => }/aio_buffer.go | 0
.../libguestfs.org/libnbd => }/callbacks.go | 0
golang/examples/get_size/go.mod | 2 +-
golang/examples/read_first_sector/go.mod | 2 +-
golang/{src/libguestfs.org/libnbd => }/go.mod | 0
.../{src/libguestfs.org/libnbd => }/handle.go | 0
.../libnbd => }/libnbd_010_load_test.go | 0
.../libnbd => }/libnbd_100_handle_test.go | 0
.../libnbd => }/libnbd_110_defaults_test.go | 0
.../libnbd_120_set_non_defaults_test.go | 0
.../libnbd_200_connect_command_test.go | 0
.../libnbd => }/libnbd_210_opt_abort_test.go | 0
.../libnbd => }/libnbd_220_opt_list_test.go | 0
.../libnbd => }/libnbd_230_opt_info_test.go | 0
.../libnbd_240_opt_list_meta_test.go | 0
.../libnbd => }/libnbd_300_get_size_test.go | 0
.../libnbd => }/libnbd_400_pread_test.go | 0
.../libnbd_405_pread_structured_test.go | 0
.../libnbd => }/libnbd_410_pwrite_test.go | 0
.../libnbd_460_block_status_test.go | 0
.../libnbd => }/libnbd_500_aio_pread_test.go | 0
.../libnbd => }/libnbd_510_aio_pwrite_test.go | 0
.../libnbd => }/libnbd_590_aio_copy_test.go | 0
.../libnbd_600_debug_callback_test.go | 0
.../libnbd => }/libnbd_610_error_test.go | 0
golang/run-tests.sh | 2 -
31 files changed, 55 insertions(+), 63 deletions(-)
rename
golang/{src/libguestfs.org/libnbd => }/.gitignore (100%)
rename
golang/{src/libguestfs.org/libnbd => }/LICENSE (100%)
rename
golang/{src/libguestfs.org/libnbd => }/README.md (71%)
rename
golang/{src/libguestfs.org/libnbd => }/aio_buffer.go (100%)
rename
golang/{src/libguestfs.org/libnbd => }/callbacks.go (100%)
rename
golang/{src/libguestfs.org/libnbd => }/go.mod (100%)
rename
golang/{src/libguestfs.org/libnbd => }/handle.go (100%)
rename
golang/{src/libguestfs.org/libnbd => }/libnbd_010_load_test.go (100%)
rename
golang/{src/libguestfs.org/libnbd => }/libnbd_100_handle_test.go (100%)
rename
golang/{src/libguestfs.org/libnbd => }/libnbd_110_defaults_test.go (100%)
rename
golang/{src/libguestfs.org/libnbd => }/libnbd_120_set_non_defaults_test.go
(100%)
rename
golang/{src/libguestfs.org/libnbd => }/libnbd_200_connect_command_test.go
(100%)
rename
golang/{src/libguestfs.org/libnbd => }/libnbd_210_opt_abort_test.go (100%)
rename
golang/{src/libguestfs.org/libnbd => }/libnbd_220_opt_list_test.go (100%)
rename
golang/{src/libguestfs.org/libnbd => }/libnbd_230_opt_info_test.go (100%)
rename
golang/{src/libguestfs.org/libnbd => }/libnbd_240_opt_list_meta_test.go
(100%)
rename
golang/{src/libguestfs.org/libnbd => }/libnbd_300_get_size_test.go (100%)
rename
golang/{src/libguestfs.org/libnbd => }/libnbd_400_pread_test.go (100%)
rename
golang/{src/libguestfs.org/libnbd => }/libnbd_405_pread_structured_test.go
(100%)
rename
golang/{src/libguestfs.org/libnbd => }/libnbd_410_pwrite_test.go (100%)
rename
golang/{src/libguestfs.org/libnbd => }/libnbd_460_block_status_test.go (100%)
rename
golang/{src/libguestfs.org/libnbd => }/libnbd_500_aio_pread_test.go (100%)
rename
golang/{src/libguestfs.org/libnbd => }/libnbd_510_aio_pwrite_test.go (100%)
rename
golang/{src/libguestfs.org/libnbd => }/libnbd_590_aio_copy_test.go (100%)
rename
golang/{src/libguestfs.org/libnbd => }/libnbd_600_debug_callback_test.go
(100%)
rename
golang/{src/libguestfs.org/libnbd => }/libnbd_610_error_test.go (100%)
diff --git a/generator/generator.ml b/generator/generator.ml
index 804d9ea..4192815 100644
--- a/generator/generator.ml
+++ b/generator/generator.ml
@@ -57,11 +57,7 @@ let () =
output_to "ocaml/NBD.ml" OCaml.generate_ocaml_nbd_ml;
output_to "ocaml/nbd-c.c" OCaml.generate_ocaml_nbd_c;
- output_to "golang/src/libguestfs.org/libnbd/bindings.go"
- GoLang.generate_golang_bindings_go;
- output_to "golang/src/libguestfs.org/libnbd/closures.go"
- GoLang.generate_golang_closures_go;
- output_to "golang/src/libguestfs.org/libnbd/wrappers.go"
- GoLang.generate_golang_wrappers_go;
- output_to "golang/src/libguestfs.org/libnbd/wrappers.h"
- GoLang.generate_golang_wrappers_h;
+ output_to "golang/bindings.go" GoLang.generate_golang_bindings_go;
+ output_to "golang/closures.go" GoLang.generate_golang_closures_go;
+ output_to "golang/wrappers.go" GoLang.generate_golang_wrappers_go;
+ output_to "golang/wrappers.h" GoLang.generate_golang_wrappers_h;
diff --git
a/golang/src/libguestfs.org/libnbd/.gitignore b/golang/.gitignore
similarity index 100%
rename from
golang/src/libguestfs.org/libnbd/.gitignore
rename to golang/.gitignore
diff --git
a/golang/src/libguestfs.org/libnbd/LICENSE b/golang/LICENSE
similarity index 100%
rename from
golang/src/libguestfs.org/libnbd/LICENSE
rename to golang/LICENSE
diff --git a/golang/Makefile.am b/golang/Makefile.am
index 397cae7..1ceef1f 100644
--- a/golang/Makefile.am
+++ b/golang/Makefile.am
@@ -17,59 +17,56 @@
include $(top_srcdir)/subdir-rules.mk
-#
http://golang.org/doc/code.html#Organization
-pkg =
libguestfs.org/libnbd
-
source_files = \
- src/$(pkg)/aio_buffer.go \
- src/$(pkg)/bindings.go \
- src/$(pkg)/callbacks.go \
- src/$(pkg)/closures.go \
- src/$(pkg)/handle.go \
- src/$(pkg)/wrappers.go \
- src/$(pkg)/wrappers.h \
- src/$(pkg)/libnbd_010_load_test.go \
- src/$(pkg)/libnbd_100_handle_test.go \
- src/$(pkg)/libnbd_110_defaults_test.go \
- src/$(pkg)/libnbd_120_set_non_defaults_test.go \
- src/$(pkg)/libnbd_200_connect_command_test.go \
- src/$(pkg)/libnbd_210_opt_abort_test.go \
- src/$(pkg)/libnbd_220_opt_list_test.go \
- src/$(pkg)/libnbd_230_opt_info_test.go \
- src/$(pkg)/libnbd_240_opt_list_meta_test.go \
- src/$(pkg)/libnbd_300_get_size_test.go \
- src/$(pkg)/libnbd_400_pread_test.go \
- src/$(pkg)/libnbd_405_pread_structured_test.go \
- src/$(pkg)/libnbd_410_pwrite_test.go \
- src/$(pkg)/libnbd_460_block_status_test.go \
- src/$(pkg)/libnbd_500_aio_pread_test.go \
- src/$(pkg)/libnbd_510_aio_pwrite_test.go \
- src/$(pkg)/libnbd_590_aio_copy_test.go \
- src/$(pkg)/libnbd_600_debug_callback_test.go \
- src/$(pkg)/libnbd_610_error_test.go \
+ aio_buffer.go \
+ bindings.go \
+ callbacks.go \
+ closures.go \
+ handle.go \
+ wrappers.go \
+ wrappers.h \
+ libnbd_010_load_test.go \
+ libnbd_100_handle_test.go \
+ libnbd_110_defaults_test.go \
+ libnbd_120_set_non_defaults_test.go \
+ libnbd_200_connect_command_test.go \
+ libnbd_210_opt_abort_test.go \
+ libnbd_220_opt_list_test.go \
+ libnbd_230_opt_info_test.go \
+ libnbd_240_opt_list_meta_test.go \
+ libnbd_300_get_size_test.go \
+ libnbd_400_pread_test.go \
+ libnbd_405_pread_structured_test.go \
+ libnbd_410_pwrite_test.go \
+ libnbd_460_block_status_test.go \
+ libnbd_500_aio_pread_test.go \
+ libnbd_510_aio_pwrite_test.go \
+ libnbd_590_aio_copy_test.go \
+ libnbd_600_debug_callback_test.go \
+ libnbd_610_error_test.go \
$(NULL)
generator_built = \
- src/$(pkg)/bindings.go \
- src/$(pkg)/closures.go \
- src/$(pkg)/wrappers.go \
- src/$(pkg)/wrappers.h \
+ bindings.go \
+ closures.go \
+ wrappers.go \
+ wrappers.h \
$(NULL)
EXTRA_DIST = \
$(generator_built) \
+ .gitignore \
+ LICENSE \
+ README.md \
+ aio_buffer.go \
+ callbacks.go \
configure/go.mod \
configure/test.go \
+ go.mod \
+ handle.go \
libnbd-golang.pod \
+ libnbd_*_test.go \
run-tests.sh \
- src/$(pkg)/.gitignore \
- src/$(pkg)/LICENSE \
- src/$(pkg)/README.md \
- src/$(pkg)/aio_buffer.go \
- src/$(pkg)/callbacks.go \
- src/$(pkg)/go.mod \
- src/$(pkg)/handle.go \
- src/$(pkg)/libnbd_*_test.go \
$(NULL)
if HAVE_POD
@@ -87,13 +84,11 @@ endif HAVE_POD
if HAVE_GOLANG
all-local: $(source_files)
- cd src/$(pkg) && \
$(abs_top_builddir)/run $(GOLANG) build
TESTS_ENVIRONMENT = \
LIBNBD_DEBUG=1 \
$(MALLOC_CHECKS) \
- pkg=$(pkg) \
abs_top_srcdir=$(abs_top_srcdir) \
$(NULL)
LOG_COMPILER = $(top_builddir)/run
@@ -101,4 +96,4 @@ TESTS = run-tests.sh
endif
-CLEANFILES += src/$(pkg)/*~
+CLEANFILES += *~
diff --git
a/golang/src/libguestfs.org/libnbd/README.md b/golang/README.md
similarity index 71%
rename from
golang/src/libguestfs.org/libnbd/README.md
rename to golang/README.md
index be32e6a..aeadcf6 100644
---
a/golang/src/libguestfs.org/libnbd/README.md
+++ b/golang/README.md
@@ -18,18 +18,21 @@ extract it from the tarball.
wget
https://download.libguestfs.org/libnbd/1.10-stable/libnbd-1.10.1.tar.gz
-2. Extract the go binding directory
+2. Extract the sources from the golang directory
- tar xvf libnbd-1.10.1.tar.gz \
- --directory pkg \
- --strip 3 \
+ mkdir pkg/libnbd
+
+ tar xvf libnbd-1.11.1.tar.gz \
+ --directory pkg/libnbd \
+ --strip 2 \
--exclude "*_test.go" \
- --exclude ".gitignore" \
-
libnbd-1.10.1/golang/src/libguestfs.org/libnbd
+ --exclude "examples" \
+ --exclude "configure" \
+ libnbd-1.11.1/golang/{go.mod,README.md,LICENSE,*.go,*.h}
3. Edit your go mode file to use the local copy
- go mod edit -replace
libguestfs.org/libnbd=./pkg/libguestfs.org/libnbd
+ go mod edit -replace
libguestfs.org/libnbd=./pkg/libnbd
4. Install the libnbd development package
diff --git
a/golang/src/libguestfs.org/libnbd/aio_buffer.go b/golang/aio_buffer.go
similarity index 100%
rename from
golang/src/libguestfs.org/libnbd/aio_buffer.go
rename to golang/aio_buffer.go
diff --git
a/golang/src/libguestfs.org/libnbd/callbacks.go b/golang/callbacks.go
similarity index 100%
rename from
golang/src/libguestfs.org/libnbd/callbacks.go
rename to golang/callbacks.go
diff --git a/golang/examples/get_size/go.mod b/golang/examples/get_size/go.mod
index 077ff31..3559751 100644
--- a/golang/examples/get_size/go.mod
+++ b/golang/examples/get_size/go.mod
@@ -1,4 +1,4 @@
module main
-replace
libguestfs.org/libnbd => ../../src/libguestfs.org/libnbd
+replace
libguestfs.org/libnbd => ../../
require
libguestfs.org/libnbd v1.0.0
diff --git a/golang/examples/read_first_sector/go.mod
b/golang/examples/read_first_sector/go.mod
index 077ff31..3559751 100644
--- a/golang/examples/read_first_sector/go.mod
+++ b/golang/examples/read_first_sector/go.mod
@@ -1,4 +1,4 @@
module main
-replace
libguestfs.org/libnbd => ../../src/libguestfs.org/libnbd
+replace
libguestfs.org/libnbd => ../../
require
libguestfs.org/libnbd v1.0.0
diff --git
a/golang/src/libguestfs.org/libnbd/go.mod b/golang/go.mod
similarity index 100%
rename from
golang/src/libguestfs.org/libnbd/go.mod
rename to golang/go.mod
diff --git
a/golang/src/libguestfs.org/libnbd/handle.go b/golang/handle.go
similarity index 100%
rename from
golang/src/libguestfs.org/libnbd/handle.go
rename to golang/handle.go
diff --git
a/golang/src/libguestfs.org/libnbd/libnbd_010_load_test.go
b/golang/libnbd_010_load_test.go
similarity index 100%
rename from
golang/src/libguestfs.org/libnbd/libnbd_010_load_test.go
rename to golang/libnbd_010_load_test.go
diff --git
a/golang/src/libguestfs.org/libnbd/libnbd_100_handle_test.go
b/golang/libnbd_100_handle_test.go
similarity index 100%
rename from
golang/src/libguestfs.org/libnbd/libnbd_100_handle_test.go
rename to golang/libnbd_100_handle_test.go
diff --git
a/golang/src/libguestfs.org/libnbd/libnbd_110_defaults_test.go
b/golang/libnbd_110_defaults_test.go
similarity index 100%
rename from
golang/src/libguestfs.org/libnbd/libnbd_110_defaults_test.go
rename to golang/libnbd_110_defaults_test.go
diff --git
a/golang/src/libguestfs.org/libnbd/libnbd_120_set_non_defaults_test.go
b/golang/libnbd_120_set_non_defaults_test.go
similarity index 100%
rename from
golang/src/libguestfs.org/libnbd/libnbd_120_set_non_defaults_test.go
rename to golang/libnbd_120_set_non_defaults_test.go
diff --git
a/golang/src/libguestfs.org/libnbd/libnbd_200_connect_command_test.go
b/golang/libnbd_200_connect_command_test.go
similarity index 100%
rename from
golang/src/libguestfs.org/libnbd/libnbd_200_connect_command_test.go
rename to golang/libnbd_200_connect_command_test.go
diff --git
a/golang/src/libguestfs.org/libnbd/libnbd_210_opt_abort_test.go
b/golang/libnbd_210_opt_abort_test.go
similarity index 100%
rename from
golang/src/libguestfs.org/libnbd/libnbd_210_opt_abort_test.go
rename to golang/libnbd_210_opt_abort_test.go
diff --git
a/golang/src/libguestfs.org/libnbd/libnbd_220_opt_list_test.go
b/golang/libnbd_220_opt_list_test.go
similarity index 100%
rename from
golang/src/libguestfs.org/libnbd/libnbd_220_opt_list_test.go
rename to golang/libnbd_220_opt_list_test.go
diff --git
a/golang/src/libguestfs.org/libnbd/libnbd_230_opt_info_test.go
b/golang/libnbd_230_opt_info_test.go
similarity index 100%
rename from
golang/src/libguestfs.org/libnbd/libnbd_230_opt_info_test.go
rename to golang/libnbd_230_opt_info_test.go
diff --git
a/golang/src/libguestfs.org/libnbd/libnbd_240_opt_list_meta_test.go
b/golang/libnbd_240_opt_list_meta_test.go
similarity index 100%
rename from
golang/src/libguestfs.org/libnbd/libnbd_240_opt_list_meta_test.go
rename to golang/libnbd_240_opt_list_meta_test.go
diff --git
a/golang/src/libguestfs.org/libnbd/libnbd_300_get_size_test.go
b/golang/libnbd_300_get_size_test.go
similarity index 100%
rename from
golang/src/libguestfs.org/libnbd/libnbd_300_get_size_test.go
rename to golang/libnbd_300_get_size_test.go
diff --git
a/golang/src/libguestfs.org/libnbd/libnbd_400_pread_test.go
b/golang/libnbd_400_pread_test.go
similarity index 100%
rename from
golang/src/libguestfs.org/libnbd/libnbd_400_pread_test.go
rename to golang/libnbd_400_pread_test.go
diff --git
a/golang/src/libguestfs.org/libnbd/libnbd_405_pread_structured_test.go
b/golang/libnbd_405_pread_structured_test.go
similarity index 100%
rename from
golang/src/libguestfs.org/libnbd/libnbd_405_pread_structured_test.go
rename to golang/libnbd_405_pread_structured_test.go
diff --git
a/golang/src/libguestfs.org/libnbd/libnbd_410_pwrite_test.go
b/golang/libnbd_410_pwrite_test.go
similarity index 100%
rename from
golang/src/libguestfs.org/libnbd/libnbd_410_pwrite_test.go
rename to golang/libnbd_410_pwrite_test.go
diff --git
a/golang/src/libguestfs.org/libnbd/libnbd_460_block_status_test.go
b/golang/libnbd_460_block_status_test.go
similarity index 100%
rename from
golang/src/libguestfs.org/libnbd/libnbd_460_block_status_test.go
rename to golang/libnbd_460_block_status_test.go
diff --git
a/golang/src/libguestfs.org/libnbd/libnbd_500_aio_pread_test.go
b/golang/libnbd_500_aio_pread_test.go
similarity index 100%
rename from
golang/src/libguestfs.org/libnbd/libnbd_500_aio_pread_test.go
rename to golang/libnbd_500_aio_pread_test.go
diff --git
a/golang/src/libguestfs.org/libnbd/libnbd_510_aio_pwrite_test.go
b/golang/libnbd_510_aio_pwrite_test.go
similarity index 100%
rename from
golang/src/libguestfs.org/libnbd/libnbd_510_aio_pwrite_test.go
rename to golang/libnbd_510_aio_pwrite_test.go
diff --git
a/golang/src/libguestfs.org/libnbd/libnbd_590_aio_copy_test.go
b/golang/libnbd_590_aio_copy_test.go
similarity index 100%
rename from
golang/src/libguestfs.org/libnbd/libnbd_590_aio_copy_test.go
rename to golang/libnbd_590_aio_copy_test.go
diff --git
a/golang/src/libguestfs.org/libnbd/libnbd_600_debug_callback_test.go
b/golang/libnbd_600_debug_callback_test.go
similarity index 100%
rename from
golang/src/libguestfs.org/libnbd/libnbd_600_debug_callback_test.go
rename to golang/libnbd_600_debug_callback_test.go
diff --git
a/golang/src/libguestfs.org/libnbd/libnbd_610_error_test.go
b/golang/libnbd_610_error_test.go
similarity index 100%
rename from
golang/src/libguestfs.org/libnbd/libnbd_610_error_test.go
rename to golang/libnbd_610_error_test.go
diff --git a/golang/run-tests.sh b/golang/run-tests.sh
index 6857047..f83fa18 100755
--- a/golang/run-tests.sh
+++ b/golang/run-tests.sh
@@ -23,8 +23,6 @@ set -x
requires nbdkit --version
-cd src/$pkg
-
# The -count=1 parameter is the "idiomatic way to bypass test caching".
#
https://golang.org/doc/go1.10#test
# The -v option enables verbose output.
--
2.31.1