[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] [PATCH nbdkit] golang: Add go.mod files, remove use of $GOPATH.



golang 1.16 defaults to this, and 1.17 will require it:
https://blog.golang.org/go116-module-changes

Fixes: https://aur.archlinux.org/packages/nbdkit/
Thanks: Svenne Krap
---
 plugins/golang/Makefile.am                      | 9 +++++----
 plugins/golang/examples/disk/go.mod             | 4 ++++
 plugins/golang/examples/dump-plugin/go.mod      | 4 ++++
 plugins/golang/examples/minimal/go.mod          | 4 ++++
 plugins/golang/examples/ramdisk/go.mod          | 4 ++++
 plugins/golang/src/libguestfs.org/nbdkit/go.mod | 4 ++++
 6 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/plugins/golang/Makefile.am b/plugins/golang/Makefile.am
index 192c2ec4..6fc4f8b4 100644
--- a/plugins/golang/Makefile.am
+++ b/plugins/golang/Makefile.am
@@ -32,6 +32,7 @@
 include $(top_srcdir)/common-rules.mk
 
 plugin_sources = \
+	src/libguestfs.org/nbdkit/go.mod \
 	src/libguestfs.org/nbdkit/nbdkit.go \
 	src/libguestfs.org/nbdkit/utils.go \
 	src/libguestfs.org/nbdkit/wrappers.go \
@@ -43,9 +44,13 @@ EXTRA_DIST = \
 	config-test.go \
 	dump-plugin-examples.sh \
 	examples/disk/disk.go \
+	examples/disk/go.mod \
 	examples/dump-plugin/dumpplugin.go \
+	examples/dump-plugin/go.mod \
 	examples/minimal/minimal.go \
+	examples/minimal/go.mod \
 	examples/ramdisk/ramdisk.go \
+	examples/ramdisk/go.mod \
 	nbdkit-golang-plugin.pod \
 	$(NULL)
 
@@ -67,28 +72,24 @@ examples/disk/nbdkit-godisk-plugin.so: \
 	    $(plugin_sources) examples/disk/disk.go
 	cd examples/disk && \
 	PKG_CONFIG_PATH="$(abs_top_builddir)/server/local$${PKG_CONFIG_PATH:+:$$PKG_CONFIG_PATH}" \
-	GOPATH="$(abs_builddir)" \
 	$(GOLANG) build -o nbdkit-godisk-plugin.so -buildmode=c-shared
 
 examples/dump-plugin/nbdkit-godump-plugin.so: \
 	    $(plugin_sources) examples/dump-plugin/dumpplugin.go
 	cd examples/dump-plugin && \
 	PKG_CONFIG_PATH="$(abs_top_builddir)/server/local$${PKG_CONFIG_PATH:+:$$PKG_CONFIG_PATH}" \
-	GOPATH="$(abs_builddir)" \
 	$(GOLANG) build -o nbdkit-godump-plugin.so -buildmode=c-shared
 
 examples/minimal/nbdkit-gominimal-plugin.so: \
 	    $(plugin_sources) examples/minimal/minimal.go
 	cd examples/minimal && \
 	PKG_CONFIG_PATH="$(abs_top_builddir)/server/local$${PKG_CONFIG_PATH:+:$$PKG_CONFIG_PATH}" \
-	GOPATH="$(abs_builddir)" \
 	$(GOLANG) build -o nbdkit-gominimal-plugin.so -buildmode=c-shared
 
 examples/ramdisk/nbdkit-goramdisk-plugin.so: \
 	    $(plugin_sources) examples/ramdisk/ramdisk.go
 	cd examples/ramdisk && \
 	PKG_CONFIG_PATH="$(abs_top_builddir)/server/local$${PKG_CONFIG_PATH:+:$$PKG_CONFIG_PATH}" \
-	GOPATH="$(abs_builddir)" \
 	$(GOLANG) build -o nbdkit-goramdisk-plugin.so -buildmode=c-shared
 
 # Tests.
diff --git a/plugins/golang/examples/disk/go.mod b/plugins/golang/examples/disk/go.mod
new file mode 100644
index 00000000..b55533c8
--- /dev/null
+++ b/plugins/golang/examples/disk/go.mod
@@ -0,0 +1,4 @@
+module main
+
+replace libguestfs.org/nbdkit => ../../src/libguestfs.org/nbdkit
+require libguestfs.org/nbdkit v1.0.0
diff --git a/plugins/golang/examples/dump-plugin/go.mod b/plugins/golang/examples/dump-plugin/go.mod
new file mode 100644
index 00000000..b55533c8
--- /dev/null
+++ b/plugins/golang/examples/dump-plugin/go.mod
@@ -0,0 +1,4 @@
+module main
+
+replace libguestfs.org/nbdkit => ../../src/libguestfs.org/nbdkit
+require libguestfs.org/nbdkit v1.0.0
diff --git a/plugins/golang/examples/minimal/go.mod b/plugins/golang/examples/minimal/go.mod
new file mode 100644
index 00000000..b55533c8
--- /dev/null
+++ b/plugins/golang/examples/minimal/go.mod
@@ -0,0 +1,4 @@
+module main
+
+replace libguestfs.org/nbdkit => ../../src/libguestfs.org/nbdkit
+require libguestfs.org/nbdkit v1.0.0
diff --git a/plugins/golang/examples/ramdisk/go.mod b/plugins/golang/examples/ramdisk/go.mod
new file mode 100644
index 00000000..b55533c8
--- /dev/null
+++ b/plugins/golang/examples/ramdisk/go.mod
@@ -0,0 +1,4 @@
+module main
+
+replace libguestfs.org/nbdkit => ../../src/libguestfs.org/nbdkit
+require libguestfs.org/nbdkit v1.0.0
diff --git a/plugins/golang/src/libguestfs.org/nbdkit/go.mod b/plugins/golang/src/libguestfs.org/nbdkit/go.mod
new file mode 100644
index 00000000..6ba51bd5
--- /dev/null
+++ b/plugins/golang/src/libguestfs.org/nbdkit/go.mod
@@ -0,0 +1,4 @@
+module libguestfs.org/nbdkit
+
+// First version of golang with working module support.
+go 1.13
-- 
2.29.0.rc2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]