Add deadcode to the linter

it tends to help keeping uneeded code out O:)

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
docker-18.09
Vincent Demeester 2018-02-01 17:59:04 -08:00
parent 55f9b044e2
commit 79e346f59a
No known key found for this signature in database
GPG Key ID: 083CC6FD6EB699A3
9 changed files with 8 additions and 40 deletions

View File

@ -13,7 +13,6 @@ import (
)
const cacheKey = "buildkit.instructioncache"
const contentCacheKey = "buildkit.instructioncache.content"
const mappingBucket = "_contentMapping"

View File

@ -1,7 +1,6 @@
package client
import (
"fmt"
"net"
"strings"
"time"
@ -14,7 +13,3 @@ func dialer(address string, timeout time.Duration) (net.Conn, error) {
address = strings.Replace(address, "/", "\\", 0)
return winio.DialPipe(address, &timeout)
}
func dialAddress(address string) string {
return fmt.Sprintf("npipe://%s", address)
}

View File

@ -18,25 +18,17 @@ var (
func addEnv(key, value string) StateOption {
return addEnvf(key, value)
}
func addEnvf(key, value string, v ...interface{}) StateOption {
return func(s State) State {
return s.WithValue(keyEnv, getEnv(s).AddOrReplace(key, fmt.Sprintf(value, v...)))
}
}
func clearEnv() StateOption {
return func(s State) State {
return s.WithValue(keyEnv, EnvList{})
}
}
func delEnv(key string) StateOption {
return func(s State) State {
return s.WithValue(keyEnv, getEnv(s).Delete(key))
}
}
func dir(str string) StateOption {
return dirf(str)
}
func dirf(str string, v ...interface{}) StateOption {
return func(s State) State {
return s.WithValue(keyDir, fmt.Sprintf(str, v...))

View File

@ -249,6 +249,8 @@ func dispatch(d *dispatchState, cmd instructions.Command, opt dispatchOpt) error
var err error
switch c := cmd.(type) {
case *instructions.MaintainerCommand:
err = dispatchMaintainer(d, c)
case *instructions.EnvCommand:
err = dispatchEnv(d, c, true)
case *instructions.RunCommand:
@ -439,7 +441,7 @@ func dispatchCopy(d *dispatchState, c instructions.SourcesAndDest, sourceState l
return commitToHistory(&d.image, commitMessage.String(), true, &d.state)
}
func dispatchMaintainer(d *dispatchState, c instructions.MaintainerCommand) error {
func dispatchMaintainer(d *dispatchState, c *instructions.MaintainerCommand) error {
d.image.Author = c.Maintainer
return commitToHistory(&d.image, fmt.Sprintf("MAINTAINER %v", c.Maintainer), false, nil)
}

View File

@ -1,12 +1,13 @@
{
"Vendor": true,
"Deadline": "8m",
"Exclude": ["solver/pb/ops.pb.go", "api/services/control/control.pb.go"],
"Exclude": [".*.pb.go"],
"DisableAll": true,
"Enable": [
"gofmt",
"goimports",
"ineffassign",
"vet"
"vet",
"deadcode"
]
}

View File

@ -14,12 +14,6 @@ import (
"google.golang.org/grpc/metadata"
)
var bufPool = sync.Pool{
New: func() interface{} {
return make([]byte, 32*1<<10)
},
}
func Dialer(api controlapi.ControlClient) session.Dialer {
return func(ctx context.Context, proto string, meta map[string][]string) (net.Conn, error) {

View File

@ -10,7 +10,6 @@ import (
"github.com/moby/buildkit/frontend"
"github.com/moby/buildkit/util/tracing"
"github.com/moby/buildkit/worker"
digest "github.com/opencontainers/go-digest"
"github.com/pkg/errors"
)
@ -22,10 +21,6 @@ type llbBridge struct {
worker.Worker
}
type resolveImageConfig interface {
ResolveImageConfig(ctx context.Context, ref string) (digest.Digest, []byte, error)
}
func (s *llbBridge) Solve(ctx context.Context, req frontend.SolveRequest) (cache.ImmutableRef, map[string][]byte, error) {
var f frontend.Frontend
if req.Frontend != "" {

View File

@ -22,11 +22,6 @@ func newVertex(dgst digest.Digest, op *pb.Op, opMeta *pb.OpMetadata, load func(d
return vtx, nil
}
func toInternalVertex(v Vertex) *vertex {
cache := make(map[digest.Digest]*vertex)
return loadInternalVertexHelper(v, cache)
}
func loadInternalVertexHelper(v Vertex, cache map[digest.Digest]*vertex) *vertex {
if v, ok := cache[v.Digest()]; ok {
return v

View File

@ -42,11 +42,6 @@ type SourceOpt struct {
CacheAccessor cache.Accessor
}
type resolveRecord struct {
desc ocispec.Descriptor
ts time.Time
}
type imageSource struct {
SourceOpt
g flightcontrol.Group