Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Make Weave build & work with Go 1.5 #1386

Merged
merged 2 commits into from
Sep 9, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ NETGO_CHECK=@strings $@ | grep cgo_stub\\\.go >/dev/null || { \
echo " sudo go install -tags netgo std"; \
false; \
}
BUILD_FLAGS=-ldflags "-extldflags \"-static\" -X main.version $(WEAVE_VERSION)" -tags netgo
BUILD_FLAGS=-ldflags "-extldflags \"-static\" -linkmode=external -X main.version=$(WEAVE_VERSION)" -tags netgo

all: $(WEAVE_EXPORT) $(COVER_EXE) $(RUNNER_EXE)

Expand Down Expand Up @@ -81,8 +81,8 @@ $(COVER_EXE): testing/cover/cover.go
$(RUNNER_EXE): testing/runner/runner.go

$(WEAVEWAIT_EXE) $(SIGPROXY_EXE) $(WEAVEHOSTS_EXE) $(COVER_EXE) $(RUNNER_EXE):
go get ./$(@D)
go build -o $@ ./$(@D)
go get -tags netgo ./$(@D)
go build $(BUILD_FLAGS) -o $@ ./$(@D)

$(WEAVER_UPTODATE): prog/weaver/Dockerfile $(WEAVER_EXE)
$(SUDO) docker build -t $(WEAVER_IMAGE) prog/weaver
Expand Down
17 changes: 11 additions & 6 deletions router/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"encoding/gob"
"fmt"
"net"
"os"

"github.com/weaveworks/weave/common"
)
Expand All @@ -26,15 +27,19 @@ func checkWarn(e error) {
}
}

// Look inside an error produced by the net package to get to the
// syscall.Errno at the root of the problem.
func PosixError(err error) error {
if err == nil {
return nil
if operr, ok := err.(*net.OpError); ok {
err = operr.Err
}
operr, ok := err.(*net.OpError)
if !ok {
return nil

// go1.5 wraps an Errno inside a SyscallError inside an OpError
if scerr, ok := err.(*os.SyscallError); ok {
err = scerr.Err
}
return operr.Err

return err
}

func (mtbe MsgTooBigError) Error() string {
Expand Down