From f883e4d4b3f5dcb7082b22d30cdda53d04d869fd Mon Sep 17 00:00:00 2001 From: mgaitonde Date: Wed, 9 Mar 2022 13:17:04 -0800 Subject: [PATCH] Expand system error message --- Dockerfile | 2 +- Makefile | 2 +- controller/system.go | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1a3bc67..c027ee6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,7 @@ COPY . /go/src/github.com/mayuresh82/gocast WORKDIR /go/src/github.com/mayuresh82/gocast -RUN make +RUN make linux FROM alpine:latest RUN apk --no-cache add ca-certificates bash iptables netcat-openbsd sudo diff --git a/Makefile b/Makefile index ec61d7f..ccbc815 100644 --- a/Makefile +++ b/Makefile @@ -13,4 +13,4 @@ test: go test -v -race -short -failfast -mod=vendor ./... linux: - GOOS=linux GOARCH=amd64 go build -o gocast_linux -mod=vendor . + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o gocast -mod=vendor . diff --git a/controller/system.go b/controller/system.go index b0e56cd..a136d1c 100644 --- a/controller/system.go +++ b/controller/system.go @@ -23,7 +23,7 @@ func gateway() (net.IP, error) { cmdList := getCmdList(cmd) out, err := exec.Command(execCmd, cmdList...).Output() if err != nil { - return nil, fmt.Errorf("Failed to execute command: %s", cmd) + return nil, fmt.Errorf("Failed to execute command: %s: %v", cmd, err) } return net.ParseIP(strings.TrimSpace(string(out))), nil } @@ -33,7 +33,7 @@ func via(dest net.IP) (net.IP, error) { cmdList := getCmdList(cmd) out, err := exec.Command(execCmd, cmdList...).Output() if err != nil { - return nil, fmt.Errorf("Failed to execute command: %s", cmd) + return nil, fmt.Errorf("Failed to execute command: %s: %v", cmd, err) } if string(out) == "" { // assume the provided dest is the next hop