Skip to content

Commit

Permalink
Update for building with go 1.16
Browse files Browse the repository at this point in the history
Due to changes in the module system, go 1.16 no longer tolerates including
local folders via
	import "../system"
Now, one is expected to reference the name of the parent project
	import "xe-guest-utilities/system"

Additional go now expects a go.mod file with listing of external dependencies
and a go.sum with hashes of those.

And go no longer allows '.' within paths that aren't URLs.

Signed-off-by: 4censord <mail@business-insulting.de>
  • Loading branch information
4censord committed May 10, 2021
1 parent 140b41b commit c9ed1de
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 14 deletions.
16 changes: 8 additions & 8 deletions Makefile
Expand Up @@ -32,16 +32,16 @@ ifeq ($(ARCH), amd64)
endif

XE_DAEMON_SOURCES :=
XE_DAEMON_SOURCES += ./xe-daemon/xe-daemon.go
XE_DAEMON_SOURCES += ./syslog/syslog.go
XE_DAEMON_SOURCES += ./system/system.go
XE_DAEMON_SOURCES += ./guestmetric/guestmetric.go
XE_DAEMON_SOURCES += ./guestmetric/guestmetric_linux.go
XE_DAEMON_SOURCES += ./xenstoreclient/xenstore.go
XE_DAEMON_SOURCES += xe-daemon/xe-daemon.go
XE_DAEMON_SOURCES += syslog/syslog.go
XE_DAEMON_SOURCES += system/system.go
XE_DAEMON_SOURCES += guestmetric/guestmetric.go
XE_DAEMON_SOURCES += guestmetric/guestmetric_linux.go
XE_DAEMON_SOURCES += xenstoreclient/xenstore.go

XENSTORE_SOURCES :=
XENSTORE_SOURCES += ./xenstore/xenstore.go
XENSTORE_SOURCES += ./xenstoreclient/xenstore.go
XENSTORE_SOURCES += xenstore/xenstore.go
XENSTORE_SOURCES += xenstoreclient/xenstore.go

.PHONY: build
build: $(DISTDIR)/$(PACKAGE)_$(VERSION)-$(RELEASE)_$(ARCH).tgz
Expand Down
5 changes: 5 additions & 0 deletions go.mod
@@ -0,0 +1,5 @@
module xe-guest-utilities

go 1.16

require golang.org/x/sys v0.0.0-20210414055047-fe65e336abe0
2 changes: 2 additions & 0 deletions go.sum
@@ -0,0 +1,2 @@
golang.org/x/sys v0.0.0-20210414055047-fe65e336abe0 h1:g9s1Ppvvun/fI+BptTMj909BBIcGrzQ32k9FNlcevOE=
golang.org/x/sys v0.0.0-20210414055047-fe65e336abe0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
2 changes: 1 addition & 1 deletion guestmetric/guestmetric_linux.go
@@ -1,7 +1,6 @@
package guestmetric

import (
xenstoreclient "../xenstoreclient"
"bufio"
"bytes"
"fmt"
Expand All @@ -11,6 +10,7 @@ import (
"sort"
"strconv"
"strings"
xenstoreclient "xe-guest-utilities/xenstoreclient"
)

type Collector struct {
Expand Down
8 changes: 4 additions & 4 deletions xe-daemon/xe-daemon.go
@@ -1,10 +1,6 @@
package main

import (
guestmetric "../guestmetric"
syslog "../syslog"
system "../system"
xenstoreclient "../xenstoreclient"
"flag"
"fmt"
"io"
Expand All @@ -15,6 +11,10 @@ import (
"strconv"
"syscall"
"time"
guestmetric "xe-guest-utilities/guestmetric"
syslog "xe-guest-utilities/syslog"
system "xe-guest-utilities/system"
xenstoreclient "xe-guest-utilities/xenstoreclient"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion xenstore/xenstore.go
@@ -1,13 +1,13 @@
package main

import (
xenstoreclient "../xenstoreclient"
"errors"
"fmt"
"golang.org/x/sys/unix"
"os"
"strconv"
"strings"
xenstoreclient "xe-guest-utilities/xenstoreclient"
)

func die(format string, a ...interface{}) {
Expand Down

0 comments on commit c9ed1de

Please sign in to comment.