diff --git a/cache/instructioncache/local/localinstructioncache.go b/cache/instructioncache/local/localinstructioncache.go index bd45e866..7bacb66a 100644 --- a/cache/instructioncache/local/localinstructioncache.go +++ b/cache/instructioncache/local/localinstructioncache.go @@ -13,7 +13,6 @@ import ( ) const cacheKey = "buildkit.instructioncache" -const contentCacheKey = "buildkit.instructioncache.content" const mappingBucket = "_contentMapping" diff --git a/client/client_windows.go b/client/client_windows.go index 637788c2..ab91df7c 100644 --- a/client/client_windows.go +++ b/client/client_windows.go @@ -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) -} diff --git a/client/llb/meta.go b/client/llb/meta.go index 3f8f8be3..b8f8af96 100644 --- a/client/llb/meta.go +++ b/client/llb/meta.go @@ -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...)) diff --git a/frontend/dockerfile/dockerfile2llb/convert.go b/frontend/dockerfile/dockerfile2llb/convert.go index 6a2755d6..b29de289 100644 --- a/frontend/dockerfile/dockerfile2llb/convert.go +++ b/frontend/dockerfile/dockerfile2llb/convert.go @@ -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) } diff --git a/gometalinter.json b/gometalinter.json index 2b3efa7d..e79b3f10 100644 --- a/gometalinter.json +++ b/gometalinter.json @@ -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" ] } diff --git a/session/grpchijack/dial.go b/session/grpchijack/dial.go index 561cf58e..151ab549 100644 --- a/session/grpchijack/dial.go +++ b/session/grpchijack/dial.go @@ -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) { diff --git a/solver/llbbridge.go b/solver/llbbridge.go index eb12ee76..8fac42cf 100644 --- a/solver/llbbridge.go +++ b/solver/llbbridge.go @@ -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 != "" { diff --git a/solver/load.go b/solver/load.go index 1914d073..d03f274d 100644 --- a/solver/load.go +++ b/solver/load.go @@ -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 diff --git a/source/containerimage/pull.go b/source/containerimage/pull.go index ee011147..98b125de 100644 --- a/source/containerimage/pull.go +++ b/source/containerimage/pull.go @@ -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