Expand system error message
This commit is contained in:
@@ -10,7 +10,7 @@ COPY . /go/src/github.com/mayuresh82/gocast
|
|||||||
|
|
||||||
WORKDIR /go/src/github.com/mayuresh82/gocast
|
WORKDIR /go/src/github.com/mayuresh82/gocast
|
||||||
|
|
||||||
RUN make
|
RUN make linux
|
||||||
|
|
||||||
FROM alpine:latest
|
FROM alpine:latest
|
||||||
RUN apk --no-cache add ca-certificates bash iptables netcat-openbsd sudo
|
RUN apk --no-cache add ca-certificates bash iptables netcat-openbsd sudo
|
||||||
|
|||||||
2
Makefile
2
Makefile
@@ -13,4 +13,4 @@ test:
|
|||||||
go test -v -race -short -failfast -mod=vendor ./...
|
go test -v -race -short -failfast -mod=vendor ./...
|
||||||
|
|
||||||
linux:
|
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 .
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ func gateway() (net.IP, error) {
|
|||||||
cmdList := getCmdList(cmd)
|
cmdList := getCmdList(cmd)
|
||||||
out, err := exec.Command(execCmd, cmdList...).Output()
|
out, err := exec.Command(execCmd, cmdList...).Output()
|
||||||
if err != nil {
|
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
|
return net.ParseIP(strings.TrimSpace(string(out))), nil
|
||||||
}
|
}
|
||||||
@@ -33,7 +33,7 @@ func via(dest net.IP) (net.IP, error) {
|
|||||||
cmdList := getCmdList(cmd)
|
cmdList := getCmdList(cmd)
|
||||||
out, err := exec.Command(execCmd, cmdList...).Output()
|
out, err := exec.Command(execCmd, cmdList...).Output()
|
||||||
if err != nil {
|
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) == "" {
|
if string(out) == "" {
|
||||||
// assume the provided dest is the next hop
|
// assume the provided dest is the next hop
|
||||||
|
|||||||
Reference in New Issue
Block a user