varlink / go

Golang implementation of the Varlink protocol
https://godoc.org/github.com/varlink/go/varlink
Apache License 2.0
55 stars 57 forks source link

Master not building on windows bridge_windows.go #22

Closed gajanak closed 4 years ago

gajanak commented 4 years ago

errormessage: varlinkbridge_windows.go:47:9: cannot use PipeCon literal (type PipeCon) as type *ctxio.Conn in assignment varlink\bridge_windows.go:49:3: c.Reader undefined (type Connection has no field or method Reader) varlink\go@v0.3.0\varlink\bridge_windows.go:50:3: c.Writer undefined (type Connection has no field or method Writer)

i changed it the same code in bridge.c

Adding import "github.com/varlink/go/varlink/internal/ctxio" change line 48-1: c.conn = ctxio.NewConn(PipeCon{nil, cmd, &r, &w}) remove lines: //c.Reader = bufio.NewReader(r) //c.Writer = bufio.NewWriter(w)

Is this correct ?

diff --git "a/varlink/bridge_windows.go" "b/varlink/bridge_windows.go"
index 42953b8..26ec6b2 100644
--- "a/varlink/bridge_windows.go"
+++ "b/varlink/bridge_windows.go"
@@ -1,11 +1,12 @@
 package varlink

 import (
-   "bufio"
    "io"
    "net"
    "os"
    "os/exec"
+
+   "github.com/varlink/go/varlink/internal/ctxio" 
 )

 type PipeCon struct {
@@ -44,10 +45,8 @@ func NewBridgeWithStderr(bridge string, stderr io.Writer) (*Connection, error) {
    if err != nil {
        return nil, err
    }
-   c.conn = PipeCon{nil, cmd, &r, &w}
+   c.conn = ctxio.NewConn(PipeCon{nil, cmd, &r, &w})
    c.address = ""
-   c.Reader = bufio.NewReader(r)
-   c.Writer = bufio.NewWriter(w)

    err = cmd.Start()
    if err != nil { 
haraldh commented 4 years ago

Thanks for reporting. The only difference should basically be the NewBridgeWithStderrI() function. I split that function off in PR #24

haraldh commented 4 years ago

https://github.com/varlink/go/releases/tag/v0.4.0