mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
golang: Fix bindings for golang 1.16.
See https://blog.golang.org/go116-module-changes
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -211,10 +211,9 @@ Makefile.in
|
||||
/gobject/guestfs-gobject.3
|
||||
/gobject/libguestfs-gobject-1.0.vapi
|
||||
/gobject/stamp-guestfs-gobject.pod
|
||||
/golang/bindtests.go
|
||||
/golang/bindtests/bindtests.go
|
||||
/golang/examples/guestfs-golang.3
|
||||
/golang/examples/stamp-guestfs-golang.pod
|
||||
/golang/pkg
|
||||
/haskell/Bindtests
|
||||
/haskell/Bindtests.hs
|
||||
/haskell/Guestfs010Load
|
||||
|
||||
@@ -301,7 +301,7 @@ Run it from the top source directory using the command
|
||||
|
||||
output_to "golang/src/libguestfs.org/guestfs/guestfs.go"
|
||||
Golang.generate_golang_go;
|
||||
output_to "golang/bindtests.go"
|
||||
output_to "golang/bindtests/bindtests.go"
|
||||
Bindtests.generate_golang_bindtests;
|
||||
|
||||
output_to "gobject/bindtests.js"
|
||||
|
||||
@@ -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
4
golang/bindtests/go.mod
Normal file
@@ -0,0 +1,4 @@
|
||||
module main
|
||||
|
||||
replace libguestfs.org/guestfs => ../src/libguestfs.org/guestfs
|
||||
require libguestfs.org/guestfs v1.0.0
|
||||
@@ -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 $@
|
||||
|
||||
4
golang/examples/create-disk/go.mod
Normal file
4
golang/examples/create-disk/go.mod
Normal file
@@ -0,0 +1,4 @@
|
||||
module main
|
||||
|
||||
replace libguestfs.org/guestfs => ../../src/libguestfs.org/guestfs
|
||||
require libguestfs.org/guestfs v1.0.0
|
||||
4
golang/examples/inspect-vm/go.mod
Normal file
4
golang/examples/inspect-vm/go.mod
Normal file
@@ -0,0 +1,4 @@
|
||||
module main
|
||||
|
||||
replace libguestfs.org/guestfs => ../../src/libguestfs.org/guestfs
|
||||
require libguestfs.org/guestfs v1.0.0
|
||||
@@ -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
|
||||
|
||||
@@ -18,4 +18,6 @@
|
||||
|
||||
set -e
|
||||
|
||||
$GOLANG test $pkg
|
||||
cd src/$pkg
|
||||
|
||||
$GOLANG test
|
||||
|
||||
4
golang/src/libguestfs.org/guestfs/go.mod
Normal file
4
golang/src/libguestfs.org/guestfs/go.mod
Normal file
@@ -0,0 +1,4 @@
|
||||
module libguestfs.org/guestfs
|
||||
|
||||
// First version of golang with working module support.
|
||||
go 1.13
|
||||
@@ -26,14 +26,6 @@ AS_IF([test "x$enable_golang" != "xno"],[
|
||||
AC_MSG_CHECKING([if $GOLANG is usable])
|
||||
AS_IF([$GOLANG run $srcdir/golang/config-test.go 2>&AS_MESSAGE_LOG_FD],[
|
||||
AC_MSG_RESULT([yes])
|
||||
|
||||
# Substitute some golang environment.
|
||||
GOOS=`$GOLANG env GOOS`
|
||||
GOARCH=`$GOLANG env GOARCH`
|
||||
GOROOT=`$GOLANG env GOROOT`
|
||||
AC_SUBST([GOOS])
|
||||
AC_SUBST([GOARCH])
|
||||
AC_SUBST([GOROOT])
|
||||
],[
|
||||
AC_MSG_RESULT([no])
|
||||
AC_MSG_WARN([golang ($GOLANG) is installed but not usable])
|
||||
|
||||
Reference in New Issue
Block a user