builder/builder-next: format code with gofumpt

Formatting the code with https://github.com/mvdan/gofumpt

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2022-01-20 13:47:31 +01:00
parent 6592646632
commit 9d4abbbc30
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
6 changed files with 16 additions and 14 deletions

View file

@ -154,8 +154,7 @@ func parseCreatedLayerInfo(img image) ([]string, []string, error) {
return dates, createdBy, nil
}
type emptyProvider struct {
}
type emptyProvider struct{}
func (p *emptyProvider) ReaderAt(ctx context.Context, dec ocispec.Descriptor) (content.ReaderAt, error) {
return nil, errors.Errorf("ReaderAt not implemented for empty provider")

View file

@ -21,11 +21,13 @@ import (
bolt "go.etcd.io/bbolt"
)
var keyParent = []byte("parent")
var keyCommitted = []byte("committed")
var keyIsCommitted = []byte("iscommitted")
var keyChainID = []byte("chainid")
var keySize = []byte("size")
var (
keyParent = []byte("parent")
keyCommitted = []byte("committed")
keyIsCommitted = []byte("iscommitted")
keyChainID = []byte("chainid")
keySize = []byte("size")
)
// Opt defines options for creating the snapshotter
type Opt struct {
@ -57,7 +59,7 @@ type snapshotter struct {
// NewSnapshotter creates a new snapshotter
func NewSnapshotter(opt Opt, prevLM leases.Manager) (snapshot.Snapshotter, leases.Manager, error) {
dbPath := filepath.Join(opt.Root, "snapshots.db")
db, err := bolt.Open(dbPath, 0600, nil)
db, err := bolt.Open(dbPath, 0o600, nil)
if err != nil {
return nil, nil, errors.Wrapf(err, "failed to open database file %s", dbPath)
}

View file

@ -224,7 +224,7 @@ func (b *Builder) Build(ctx context.Context, opt backend.BuildConfig) (*builder.
return nil, errors.Errorf("multiple outputs not supported")
}
var rc = opt.Source
rc := opt.Source
if buildID := opt.Options.BuildID; buildID != "" {
b.mu.Lock()
@ -466,6 +466,7 @@ func (sp *streamProxy) SetTrailer(_ grpcmetadata.MD) {
func (sp *streamProxy) Context() context.Context {
return sp.ctx
}
func (sp *streamProxy) RecvMsg(m interface{}) error {
return io.EOF
}
@ -478,6 +479,7 @@ type statusProxy struct {
func (sp *statusProxy) Send(resp *controlapi.StatusResponse) error {
return sp.SendMsg(resp)
}
func (sp *statusProxy) SendMsg(m interface{}) error {
if sr, ok := m.(*controlapi.StatusResponse); ok {
sp.ch <- sr
@ -493,6 +495,7 @@ type pruneProxy struct {
func (sp *pruneProxy) Send(resp *controlapi.UsageRecord) error {
return sp.SendMsg(resp)
}
func (sp *pruneProxy) SendMsg(m interface{}) error {
if sr, ok := m.(*controlapi.UsageRecord); ok {
sp.ch <- sr

View file

@ -195,7 +195,7 @@ func newGraphDriverController(ctx context.Context, rt http.RoundTripper, opt Opt
return nil, err
}
db, err := bolt.Open(filepath.Join(root, "containerdmeta.db"), 0644, nil)
db, err := bolt.Open(filepath.Join(root, "containerdmeta.db"), 0o644, nil)
if err != nil {
return nil, errors.WithStack(err)
}

View file

@ -15,8 +15,7 @@ func newExecutor(_, _ string, _ *libnetwork.Controller, _ *oci.DNSConfig, _ bool
return &winExecutor{}, nil
}
type winExecutor struct {
}
type winExecutor struct{}
func (w *winExecutor) Run(ctx context.Context, id string, root executor.Mount, mounts []executor.Mount, process executor.ProcessInfo, started chan<- struct{}) (err error) {
return errors.New("buildkit executor not implemented for windows")

View file

@ -520,8 +520,7 @@ func oneOffProgress(ctx context.Context, id string) func(err error) error {
}
}
type emptyProvider struct {
}
type emptyProvider struct{}
func (p *emptyProvider) ReaderAt(ctx context.Context, dec ocispec.Descriptor) (content.ReaderAt, error) {
return nil, errors.Errorf("ReaderAt not implemented for empty provider")