diff --git a/.appveyor.yml b/.appveyor.yml index 267911d83..ab73bcd0f 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -26,6 +26,7 @@ before_build: build_script: - bash.exe -elc "export PATH=/c/tools/mingw64/bin:$PATH ; mingw32-make.exe setup" - bash.exe -elc "export PATH=/c/tools/mingw64/bin:$PATH ; mingw32-make.exe fmt" + - bash.exe -elc "export PATH=/c/tools/mingw64/bin:/c/gopath/bin:$PATH ; mingw32-make.exe lint" - bash.exe -elc "export PATH=/c/tools/mingw64/bin:$PATH ; mingw32-make.exe vet" - bash.exe -elc "export PATH=/c/tools/mingw64/bin:/c/gopath/bin:$PATH ; mingw32-make.exe ineffassign" - bash.exe -elc "export PATH=/c/tools/mingw64/bin:$PATH ; mingw32-make.exe build" diff --git a/.travis.yml b/.travis.yml index ad596d898..221639cea 100644 --- a/.travis.yml +++ b/.travis.yml @@ -53,8 +53,8 @@ script: # Note that `go build -i` requires write permission to GOROOT. (So it is not called in Makefile) - go build -i . - make setup + - make lint - make vet - - if [ "$GOOS" = "linux" ]; then make lint ; fi - make ineffassign - if [ "$GOOS" = "linux" ]; then make check-protos check-api-descriptors; fi - make build diff --git a/dialer_windows.go b/dialer_windows.go index c91a32617..43625ef1f 100644 --- a/dialer_windows.go +++ b/dialer_windows.go @@ -24,6 +24,7 @@ func dialer(address string, timeout time.Duration) (net.Conn, error) { return winio.DialPipe(address, &timeout) } +// DialAddress returns the dial address func DialAddress(address string) string { return address } diff --git a/mount/mount_windows.go b/mount/mount_windows.go index 8eeca6817..8ad7eab12 100644 --- a/mount/mount_windows.go +++ b/mount/mount_windows.go @@ -3,17 +3,21 @@ package mount import "github.com/pkg/errors" var ( + // ErrNotImplementOnWindows is returned when an action is not implemented for windows ErrNotImplementOnWindows = errors.New("not implemented under windows") ) +// Mount to the provided target func (m *Mount) Mount(target string) error { return ErrNotImplementOnWindows } +// Unmount the mount at the provided path func Unmount(mount string, flags int) error { return ErrNotImplementOnWindows } +// UnmountAll mounts at the provided path func UnmountAll(mount string, flags int) error { return ErrNotImplementOnWindows } diff --git a/plugin/plugin.go b/plugin/plugin.go index 8db0886b6..9bda46cbf 100644 --- a/plugin/plugin.go +++ b/plugin/plugin.go @@ -64,7 +64,7 @@ type Registration struct { ID string // Config specific to the plugin Config interface{} - // Requires is a list of plugins that the registered plugin requires to be avaliable + // Requires is a list of plugins that the registered plugin requires to be available Requires []Type // InitFn is called when initializing a plugin. The registration and diff --git a/snapshot/windows/windows.go b/snapshot/windows/windows.go index ee339eba9..b36273d85 100644 --- a/snapshot/windows/windows.go +++ b/snapshot/windows/windows.go @@ -12,6 +12,7 @@ import ( ) var ( + // ErrNotImplemented is returned when an action is not implemented ErrNotImplemented = errors.New("not implemented") ) @@ -25,12 +26,13 @@ func init() { }) } -type Snapshotter struct { +type snapshotter struct { root string } +// NewSnapshotter returns a new windows snapshotter func NewSnapshotter(root string) (snapshot.Snapshotter, error) { - return &Snapshotter{ + return &snapshotter{ root: root, }, nil } @@ -40,23 +42,23 @@ func NewSnapshotter(root string) (snapshot.Snapshotter, error) { // // Should be used for parent resolution, existence checks and to discern // the kind of snapshot. -func (o *Snapshotter) Stat(ctx context.Context, key string) (snapshot.Info, error) { +func (o *snapshotter) Stat(ctx context.Context, key string) (snapshot.Info, error) { panic("not implemented") } -func (o *Snapshotter) Update(ctx context.Context, info snapshot.Info, fieldpaths ...string) (snapshot.Info, error) { +func (o *snapshotter) Update(ctx context.Context, info snapshot.Info, fieldpaths ...string) (snapshot.Info, error) { panic("not implemented") } -func (o *Snapshotter) Usage(ctx context.Context, key string) (snapshot.Usage, error) { +func (o *snapshotter) Usage(ctx context.Context, key string) (snapshot.Usage, error) { panic("not implemented") } -func (o *Snapshotter) Prepare(ctx context.Context, key, parent string, opts ...snapshot.Opt) ([]mount.Mount, error) { +func (o *snapshotter) Prepare(ctx context.Context, key, parent string, opts ...snapshot.Opt) ([]mount.Mount, error) { panic("not implemented") } -func (o *Snapshotter) View(ctx context.Context, key, parent string, opts ...snapshot.Opt) ([]mount.Mount, error) { +func (o *snapshotter) View(ctx context.Context, key, parent string, opts ...snapshot.Opt) ([]mount.Mount, error) { panic("not implemented") } @@ -64,21 +66,21 @@ func (o *Snapshotter) View(ctx context.Context, key, parent string, opts ...snap // called on an read-write or readonly transaction. // // This can be used to recover mounts after calling View or Prepare. -func (o *Snapshotter) Mounts(ctx context.Context, key string) ([]mount.Mount, error) { +func (o *snapshotter) Mounts(ctx context.Context, key string) ([]mount.Mount, error) { panic("not implemented") } -func (o *Snapshotter) Commit(ctx context.Context, name, key string, opts ...snapshot.Opt) error { +func (o *snapshotter) Commit(ctx context.Context, name, key string, opts ...snapshot.Opt) error { panic("not implemented") } // Remove abandons the transaction identified by key. All resources // associated with the key will be removed. -func (o *Snapshotter) Remove(ctx context.Context, key string) error { +func (o *snapshotter) Remove(ctx context.Context, key string) error { panic("not implemented") } // Walk the committed snapshots. -func (o *Snapshotter) Walk(ctx context.Context, fn func(context.Context, snapshot.Info) error) error { +func (o *snapshotter) Walk(ctx context.Context, fn func(context.Context, snapshot.Info) error) error { panic("not implemented") } diff --git a/spec_opts_windows.go b/spec_opts_windows.go index 5aa5c3029..1fc5d5e37 100644 --- a/spec_opts_windows.go +++ b/spec_opts_windows.go @@ -15,6 +15,7 @@ import ( specs "github.com/opencontainers/runtime-spec/specs-go" ) +// WithImageConfig configures the spec to from the configuration of an Image func WithImageConfig(i Image) SpecOpts { return func(ctx context.Context, client *Client, _ *containers.Container, s *specs.Spec) error { var ( @@ -51,6 +52,8 @@ func WithImageConfig(i Image) SpecOpts { } } +// WithTTY sets the information on the spec as well as the environment variables for +// using a TTY func WithTTY(width, height int) SpecOpts { return func(_ context.Context, _ *Client, _ *containers.Container, s *specs.Spec) error { s.Process.Terminal = true @@ -63,6 +66,7 @@ func WithTTY(width, height int) SpecOpts { } } +// WithResources sets the provided resources on the spec for task updates func WithResources(resources *specs.WindowsResources) UpdateTaskOpts { return func(ctx context.Context, client *Client, r *UpdateTaskInfo) error { r.Resources = resources diff --git a/sys/oom_windows.go b/sys/oom_windows.go index a72568b27..6e42ddce8 100644 --- a/sys/oom_windows.go +++ b/sys/oom_windows.go @@ -1,5 +1,8 @@ package sys +// SetOOMScore sets the oom score for the process +// +// Not implemented on Windows func SetOOMScore(pid, score int) error { return nil } diff --git a/windows/runtime.go b/windows/runtime.go index aa361ac4c..e6553fac8 100644 --- a/windows/runtime.go +++ b/windows/runtime.go @@ -50,6 +50,7 @@ func init() { }) } +// New returns a new Windows runtime func New(ic *plugin.InitContext) (interface{}, error) { if err := os.MkdirAll(ic.Root, 0700); err != nil { return nil, errors.Wrapf(err, "could not create state directory at %s", ic.Root)