Add structcheck, unused, and varcheck linters.
Warn on unused and dead code Signed-off-by: Daniel Nephin <dnephin@gmail.com>
This commit is contained in:
@@ -133,13 +133,6 @@ var pushCommand = cli.Command{
|
||||
},
|
||||
}
|
||||
|
||||
type pushStatus struct {
|
||||
name string
|
||||
started bool
|
||||
written int64
|
||||
total int64
|
||||
}
|
||||
|
||||
type pushjobs struct {
|
||||
jobs map[string]struct{}
|
||||
ordered []string
|
||||
|
||||
@@ -14,8 +14,6 @@ import (
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
const pipeRoot = `\\.\pipe`
|
||||
|
||||
func init() {
|
||||
Command.Flags = append(Command.Flags, cli.StringSliceFlag{
|
||||
Name: "layer",
|
||||
@@ -50,10 +48,6 @@ func withTTY(terminal bool) containerd.SpecOpts {
|
||||
return containerd.WithTTY(int(size.Width), int(size.Height))
|
||||
}
|
||||
|
||||
func setHostNetworking() containerd.SpecOpts {
|
||||
return nil
|
||||
}
|
||||
|
||||
func newContainer(ctx gocontext.Context, client *containerd.Client, context *cli.Context) (containerd.Container, error) {
|
||||
var (
|
||||
// ref = context.Args().First()
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
package shim
|
||||
|
||||
import (
|
||||
"io"
|
||||
"net"
|
||||
"os"
|
||||
"sync"
|
||||
|
||||
"github.com/Microsoft/go-winio"
|
||||
clog "github.com/containerd/containerd/log"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
func prepareStdio(stdin, stdout, stderr string, console bool) (*sync.WaitGroup, error) {
|
||||
var wg sync.WaitGroup
|
||||
|
||||
if stdin != "" {
|
||||
l, err := winio.ListenPipe(stdin, nil)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "failed to create stdin pipe %s", stdin)
|
||||
}
|
||||
defer func(l net.Listener) {
|
||||
if err != nil {
|
||||
l.Close()
|
||||
}
|
||||
}(l)
|
||||
|
||||
go func() {
|
||||
c, err := l.Accept()
|
||||
if err != nil {
|
||||
clog.L.WithError(err).Errorf("failed to accept stdin connection on %s", stdin)
|
||||
return
|
||||
}
|
||||
io.Copy(c, os.Stdin)
|
||||
c.Close()
|
||||
l.Close()
|
||||
}()
|
||||
}
|
||||
|
||||
if stdout != "" {
|
||||
l, err := winio.ListenPipe(stdout, nil)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "failed to create stdin pipe %s", stdout)
|
||||
}
|
||||
defer func(l net.Listener) {
|
||||
if err != nil {
|
||||
l.Close()
|
||||
}
|
||||
}(l)
|
||||
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
c, err := l.Accept()
|
||||
if err != nil {
|
||||
clog.L.WithError(err).Errorf("failed to accept stdout connection on %s", stdout)
|
||||
return
|
||||
}
|
||||
io.Copy(os.Stdout, c)
|
||||
c.Close()
|
||||
l.Close()
|
||||
}()
|
||||
}
|
||||
|
||||
if !console && stderr != "" {
|
||||
l, err := winio.ListenPipe(stderr, nil)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "failed to create stderr pipe %s", stderr)
|
||||
}
|
||||
defer func(l net.Listener) {
|
||||
if err != nil {
|
||||
l.Close()
|
||||
}
|
||||
}(l)
|
||||
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
c, err := l.Accept()
|
||||
if err != nil {
|
||||
clog.L.WithError(err).Errorf("failed to accept stderr connection on %s", stderr)
|
||||
return
|
||||
}
|
||||
io.Copy(os.Stderr, c)
|
||||
c.Close()
|
||||
l.Close()
|
||||
}()
|
||||
}
|
||||
|
||||
return &wg, nil
|
||||
}
|
||||
Reference in New Issue
Block a user