Fix windows compile for dialer package

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby 2017-11-07 10:43:53 -05:00
parent bba473aeb1
commit fc08f019f3
5 changed files with 17 additions and 17 deletions

View File

@ -1,7 +1,6 @@
package dialer
import (
"fmt"
"net"
"time"
@ -13,12 +12,6 @@ type dialResult struct {
err error
}
// DialAddress returns the address with unix:// prepended to the
// provided address
func DialAddress(address string) string {
return fmt.Sprintf("unix://%s", address)
}
// Dialer returns a GRPC net.Conn connected to the provided address
func Dialer(address string, timeout time.Duration) (net.Conn, error) {
var (

View File

@ -3,6 +3,7 @@
package dialer
import (
"fmt"
"net"
"os"
"strings"
@ -10,6 +11,12 @@ import (
"time"
)
// DialAddress returns the address with unix:// prepended to the
// provided address
func DialAddress(address string) string {
return fmt.Sprintf("unix://%s", address)
}
func isNoent(err error) bool {
if err != nil {
if nerr, ok := err.(*net.OpError); ok {

View File

@ -71,7 +71,7 @@ func TestExchangeBasic(t *testing.T) {
cancel: cancel2,
},
} {
var received []Event
var received []events.Event
subscribercheck:
for {
select {

View File

@ -72,11 +72,11 @@ type bundle struct {
}
// ShimOpt specifies shim options for initialization and connection
type ShimOpt func(*bundle, string, *runcopts.RuncOptions) (shim.Config, client.ClientOpt)
type ShimOpt func(*bundle, string, *runcopts.RuncOptions) (shim.Config, client.Opt)
// ShimRemote is a ShimOpt for connecting and starting a remote shim
func ShimRemote(shimBinary, daemonAddress, cgroup string, nonewns, debug bool, exitHandler func()) ShimOpt {
return func(b *bundle, ns string, ropts *runcopts.RuncOptions) (shim.Config, client.ClientOpt) {
return func(b *bundle, ns string, ropts *runcopts.RuncOptions) (shim.Config, client.Opt) {
return b.shimConfig(ns, ropts),
client.WithStart(shimBinary, b.shimAddress(ns), daemonAddress, cgroup, nonewns, debug, exitHandler)
}
@ -84,14 +84,14 @@ func ShimRemote(shimBinary, daemonAddress, cgroup string, nonewns, debug bool, e
// ShimLocal is a ShimOpt for using an in process shim implementation
func ShimLocal(exchange *exchange.Exchange) ShimOpt {
return func(b *bundle, ns string, ropts *runcopts.RuncOptions) (shim.Config, client.ClientOpt) {
return func(b *bundle, ns string, ropts *runcopts.RuncOptions) (shim.Config, client.Opt) {
return b.shimConfig(ns, ropts), client.WithLocal(exchange)
}
}
// ShimConnect is a ShimOpt for connecting to an existing remote shim
func ShimConnect() ShimOpt {
return func(b *bundle, ns string, ropts *runcopts.RuncOptions) (shim.Config, client.ClientOpt) {
return func(b *bundle, ns string, ropts *runcopts.RuncOptions) (shim.Config, client.Opt) {
return b.shimConfig(ns, ropts), client.WithConnect(b.shimAddress(ns))
}
}

View File

@ -31,11 +31,11 @@ import (
var empty = &google_protobuf.Empty{}
// ClientOpt is an option for a shim client configuration
type ClientOpt func(context.Context, shim.Config) (shimapi.ShimClient, io.Closer, error)
// Opt is an option for a shim client configuration
type Opt func(context.Context, shim.Config) (shimapi.ShimClient, io.Closer, error)
// WithStart executes a new shim process
func WithStart(binary, address, daemonAddress, cgroup string, nonewns, debug bool, exitHandler func()) ClientOpt {
func WithStart(binary, address, daemonAddress, cgroup string, nonewns, debug bool, exitHandler func()) Opt {
return func(ctx context.Context, config shim.Config) (_ shimapi.ShimClient, _ io.Closer, err error) {
socket, err := newSocket(address)
if err != nil {
@ -164,7 +164,7 @@ func dialAddress(address string) string {
}
// WithConnect connects to an existing shim
func WithConnect(address string) ClientOpt {
func WithConnect(address string) Opt {
return func(ctx context.Context, config shim.Config) (shimapi.ShimClient, io.Closer, error) {
conn, err := connect(address, annonDialer)
if err != nil {
@ -186,7 +186,7 @@ func WithLocal(publisher events.Publisher) func(context.Context, shim.Config) (s
}
// New returns a new shim client
func New(ctx context.Context, config shim.Config, opt ClientOpt) (*Client, error) {
func New(ctx context.Context, config shim.Config, opt Opt) (*Client, error) {
s, c, err := opt(ctx, config)
if err != nil {
return nil, err