ran govend, go lint and updated bake, build

Signed-off-by: zelahi <elahi.zuhayr@gmail.com>
pull/112/head
zelahi 6 years ago
parent fe95c1b44a
commit e3a251e962
No known key found for this signature in database
GPG Key ID: 67A3278BB4E58FCD

@ -3,7 +3,6 @@ package bake
import ( import (
"context" "context"
"io/ioutil" "io/ioutil"
"os"
"path" "path"
"strings" "strings"
@ -299,7 +298,7 @@ func toBuildOpt(t Target, noCache, pull bool) (*build.Options, error) {
} }
bo.Platforms = platforms bo.Platforms = platforms
bo.Session = append(bo.Session, authprovider.NewDockerAuthProvider(os.Stderr)) bo.Session = append(bo.Session, authprovider.NewDockerAuthProvider())
secrets, err := build.ParseSecretSpecs(t.Secrets) secrets, err := build.ParseSecretSpecs(t.Secrets)
if err != nil { if err != nil {

@ -102,7 +102,7 @@ func runBuild(dockerCli command.Cli, in buildOptions) error {
} }
opts.Platforms = platforms opts.Platforms = platforms
opts.Session = append(opts.Session, authprovider.NewDockerAuthProvider(os.Stderr)) opts.Session = append(opts.Session, authprovider.NewDockerAuthProvider())
secrets, err := build.ParseSecretSpecs(in.secrets) secrets, err := build.ParseSecretSpecs(in.secrets)
if err != nil { if err != nil {

@ -26,7 +26,6 @@ require (
github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c // indirect github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c // indirect
github.com/docker/go-connections v0.4.0 // indirect github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-metrics v0.0.0-20170502235133-d466d4f6fd96 // indirect github.com/docker/go-metrics v0.0.0-20170502235133-d466d4f6fd96 // indirect
github.com/docker/go-units v0.3.1
github.com/docker/libtrust v0.0.0-20150526203908-9cbd2a1374f4 // indirect github.com/docker/libtrust v0.0.0-20150526203908-9cbd2a1374f4 // indirect
github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5 // indirect github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5 // indirect
github.com/ghodss/yaml v1.0.0 // indirect github.com/ghodss/yaml v1.0.0 // indirect

@ -184,8 +184,6 @@ github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQz
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/moby/buildkit v0.5.1 h1:a2JHgsMuN/KGafhNK+AxmAIIov9itJTT4z3TyFTSE4c= github.com/moby/buildkit v0.5.1 h1:a2JHgsMuN/KGafhNK+AxmAIIov9itJTT4z3TyFTSE4c=
github.com/moby/buildkit v0.5.1/go.mod h1:MlzfF7dLLq+tMiE5Dt8qD2iwXvZa1OnwWxMZX/wjBWs= github.com/moby/buildkit v0.5.1/go.mod h1:MlzfF7dLLq+tMiE5Dt8qD2iwXvZa1OnwWxMZX/wjBWs=
github.com/moby/buildkit v0.5.2-0.20190513182223-f238f1efb04f h1:gNiytoQ3/71JJKWbLPtxoInde5kBRpvqH6EbUf12JDU=
github.com/moby/buildkit v0.5.2-0.20190513182223-f238f1efb04f/go.mod h1:RozsxlEOjPuX/zKKrd0ZS76dlVNZu4qAff+vj7hR/qs=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI= github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=

@ -410,6 +410,9 @@ func parseCacheOptions(opt SolveOpt) (*cacheOptions, error) {
if csDir == "" { if csDir == "" {
return nil, errors.New("local cache importer requires src") return nil, errors.New("local cache importer requires src")
} }
if err := os.MkdirAll(csDir, 0755); err != nil {
return nil, err
}
cs, err := contentlocal.NewStore(csDir) cs, err := contentlocal.NewStore(csDir)
if err != nil { if err != nil {
return nil, err return nil, err

@ -28,8 +28,6 @@ type GrpcClient interface {
} }
func New(ctx context.Context, opts map[string]string, session, product string, c pb.LLBBridgeClient, w []client.WorkerInfo) (GrpcClient, error) { func New(ctx context.Context, opts map[string]string, session, product string, c pb.LLBBridgeClient, w []client.WorkerInfo) (GrpcClient, error) {
ctx, cancel := context.WithTimeout(ctx, 5*time.Second)
defer cancel()
resp, err := c.Ping(ctx, &pb.PingRequest{}) resp, err := c.Ping(ctx, &pb.PingRequest{})
if err != nil { if err != nil {
return nil, err return nil, err

@ -2,7 +2,7 @@ package authprovider
import ( import (
"context" "context"
"io" "io/ioutil"
"sync" "sync"
"github.com/docker/cli/cli/config" "github.com/docker/cli/cli/config"
@ -12,9 +12,9 @@ import (
"google.golang.org/grpc" "google.golang.org/grpc"
) )
func NewDockerAuthProvider(stderr io.Writer) session.Attachable { func NewDockerAuthProvider() session.Attachable {
return &authProvider{ return &authProvider{
config: config.LoadDefaultConfigFile(stderr), config: config.LoadDefaultConfigFile(ioutil.Discard),
} }
} }

@ -46,7 +46,6 @@ type conn struct {
closedOnce sync.Once closedOnce sync.Once
readMu sync.Mutex readMu sync.Mutex
writeMu sync.Mutex
err error err error
closeCh chan struct{} closeCh chan struct{}
} }
@ -80,8 +79,6 @@ func (c *conn) Read(b []byte) (n int, err error) {
} }
func (c *conn) Write(b []byte) (int, error) { func (c *conn) Write(b []byte) (int, error) {
c.writeMu.Lock()
defer c.writeMu.Unlock()
m := &controlapi.BytesMessage{Data: b} m := &controlapi.BytesMessage{Data: b}
if err := c.stream.SendMsg(m); err != nil { if err := c.stream.SendMsg(m); err != nil {
return 0, err return 0, err
@ -96,9 +93,7 @@ func (c *conn) Close() (err error) {
}() }()
if cs, ok := c.stream.(grpc.ClientStream); ok { if cs, ok := c.stream.(grpc.ClientStream); ok {
c.writeMu.Lock()
err = cs.CloseSend() err = cs.CloseSend()
c.writeMu.Unlock()
if err != nil { if err != nil {
return return
} }
@ -111,7 +106,6 @@ func (c *conn) Close() (err error) {
err = c.stream.RecvMsg(m) err = c.stream.RecvMsg(m)
if err != nil { if err != nil {
if err != io.EOF { if err != io.EOF {
c.readMu.Unlock()
return return
} }
err = nil err = nil

@ -162,9 +162,7 @@ func (sm *Manager) Get(ctx context.Context, id string) (Caller, error) {
go func() { go func() {
select { select {
case <-ctx.Done(): case <-ctx.Done():
sm.mu.Lock()
sm.updateCondition.Broadcast() sm.updateCondition.Broadcast()
sm.mu.Unlock()
} }
}() }()

@ -259,7 +259,7 @@ github.com/matttproud/golang_protobuf_extensions/pbutil
github.com/miekg/pkcs11 github.com/miekg/pkcs11
# github.com/mitchellh/mapstructure v1.1.2 # github.com/mitchellh/mapstructure v1.1.2
github.com/mitchellh/mapstructure github.com/mitchellh/mapstructure
# github.com/moby/buildkit v0.5.2-0.20190513182223-f238f1efb04f # github.com/moby/buildkit v0.5.1
github.com/moby/buildkit/session/auth/authprovider github.com/moby/buildkit/session/auth/authprovider
github.com/moby/buildkit/client github.com/moby/buildkit/client
github.com/moby/buildkit/session github.com/moby/buildkit/session

Loading…
Cancel
Save