golang: Fix bindings for golang 1.16.

See https://blog.golang.org/go116-module-changes
This commit is contained in:
Richard W.M. Jones
2021-04-08 12:03:39 +01:00
parent 0f54df53d2
commit 95de3f6c50
14 changed files with 36 additions and 35 deletions

View File

@@ -26,27 +26,20 @@ source_files = \
generator_built = \
$(source_files) \
bindtests.go
bindtests/bindtests.go
EXTRA_DIST = \
src/libguestfs.org/guestfs/.gitignore \
$(generator_built) \
bindtests/go.mod \
config-test.go \
run-bindtests \
run-tests
if HAVE_GOLANG
golangpkgdir = $(GOROOT)/pkg/$(GOOS)_$(GOARCH)/$(pkg)
golangsrcdir = $(GOROOT)/src/pkg/$(pkg)
golangpkg_DATA = \
pkg/$(GOOS)_$(GOARCH)/$(pkg).a
pkg/$(GOOS)_$(GOARCH)/$(pkg).a: src/$(pkg)/guestfs.go
$(top_builddir)/run $(GOLANG) install $(pkg)
golangsrc_DATA = $(source_files)
all-local: $(source_files)
cd src/$(pkg) && $(GOLANG) build
TESTS_ENVIRONMENT = pkg=$(pkg) $(top_builddir)/run $(VG) # --test
@@ -55,6 +48,3 @@ TESTS = run-bindtests run-tests
endif
CLEANFILES += src/$(pkg)/*~
clean-local:
rm -rf pkg

4
golang/bindtests/go.mod Normal file
View File

@@ -0,0 +1,4 @@
module main
replace libguestfs.org/guestfs => ../src/libguestfs.org/guestfs
require libguestfs.org/guestfs v1.0.0

View File

@@ -19,8 +19,10 @@ include $(top_srcdir)/subdir-rules.mk
EXTRA_DIST = \
LICENSE \
create-disk.go \
inspect-vm.go \
create-disk/go.mod \
create-disk/create-disk.go \
inspect-vm/go.mod \
inspect-vm/inspect-vm.go \
guestfs-golang.pod
man_MANS = guestfs-golang.3
@@ -28,13 +30,14 @@ noinst_DATA = $(top_builddir)/website/guestfs-golang.3.html
guestfs-golang.3 $(top_builddir)/website/guestfs-golang.3.html: stamp-guestfs-golang.pod
stamp-guestfs-golang.pod: guestfs-golang.pod create-disk.go inspect-vm.go
stamp-guestfs-golang.pod: guestfs-golang.pod \
create-disk/create-disk.go inspect-vm/inspect-vm.go
$(PODWRAPPER) \
--section 3 \
--man guestfs-golang.3 \
--html $(top_builddir)/website/guestfs-golang.3.html \
--verbatim $(srcdir)/create-disk.go:@EXAMPLE1@ \
--verbatim $(srcdir)/inspect-vm.go:@EXAMPLE2@ \
--verbatim $(srcdir)/create-disk/create-disk.go:@EXAMPLE1@ \
--verbatim $(srcdir)/inspect-vm/inspect-vm.go:@EXAMPLE2@ \
--license examples \
$<
touch $@

View File

@@ -0,0 +1,4 @@
module main
replace libguestfs.org/guestfs => ../../src/libguestfs.org/guestfs
require libguestfs.org/guestfs v1.0.0

View File

@@ -0,0 +1,4 @@
module main
replace libguestfs.org/guestfs => ../../src/libguestfs.org/guestfs
require libguestfs.org/guestfs v1.0.0

View File

@@ -18,6 +18,7 @@
set -e
$GOLANG run $srcdir/bindtests.go > bindtests.tmp
diff -u $srcdir/../bindtests bindtests.tmp
cd $srcdir/bindtests
$GOLANG run bindtests.go > bindtests.tmp
diff -u $srcdir/../../bindtests bindtests.tmp
rm bindtests.tmp

View File

@@ -18,4 +18,6 @@
set -e
$GOLANG test $pkg
cd src/$pkg
$GOLANG test

View File

@@ -0,0 +1,4 @@
module libguestfs.org/guestfs
// First version of golang with working module support.
go 1.13