You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: builder.go
    path of file: ./repos/traefik/pkg/plugins
    
    the code of the file until where you have to start completion: package plugins

import (
	"context"
	"errors"
	"fmt"
	"net/http"
	"path/filepath"

	"github.com/rs/zerolog/log"
)

// Constructor creates a plugin handler.
type Constructor func(context.Context, http.Handler) (http.Handler, error)

type pluginMiddleware interface {
	NewHandler(ctx context.Context, next http.Handler) (http.Handler, error)
}

type middlewareBuilder interface {
	newMiddleware(config map[string]interface{}, middlewareName string) (pluginMiddleware, error)
}

// Builder is a plugin builder.
type Builder struct {
	providerBuilders   map[string]providerBuilder
	middlewareBuilders map[string]middlewareBuilder
}

// NewBuilder creates a new Builder.
func NewBuilder(client *Client, plugins map[string]Descriptor, localPlugins map[string]LocalDescriptor) (*Builder, error) {
	ctx := context.Background()

	pb := &Builder{
		middlewareBuilders: map[string]middlewareBuilder{},
		providerBuilders:   map[string]providerBuilder{},
	}

	for pName, desc := range plugins {
		manifest, err := client.ReadManifest(desc.ModuleName)
		if err != nil {
			_ = client.ResetAll()
			return nil, fmt.Errorf("%s: failed to read manifest: %w", desc.ModuleName, err)
		}

		logger := log.With().
			Str("plugin", "plugin-"+pName).
			Str("module", desc.ModuleName).
			Str("runtime", manifest.Runtime).
			Logger()
		logCtx := logger.WithContext(c
    
func NewBuilder(client *Client, plugins map[string]Descriptor, localPlugins map[string]LocalDescriptor) (*Builder, error) {
	ctx := context.Background()

	pb := &Builder{
		middlewareBuilders: map[string]middlewareBuilder{},
		providerBuilders:   map[string]providerBuilder{},
	}

	for pName, desc := range plugins {
		manifest, err := client.ReadManifest(desc.ModuleName)
		if err != nil {
			_ = client.ResetAll()
			return nil, fmt.Errorf("%s: failed to read manifest: %w", desc.ModuleName, err)
		}

		logger := log.With().
			Str("plugin", "plugin-"+pName).
			Str("module", desc.ModuleName).
			Str("runtime", manifest.Runtime).
			Logger()
		logCtx := logger.WithContext(ctx)

		switch manifest.Type {
		case typeMiddleware:
			middleware, err := newMiddlewareBuilder(logCtx, client.GoPath(), manifest, desc.ModuleName)
			if err != nil {
				return nil, err
			}

			pb.middlewareBuilders[pName] = middleware

		case typeProvider:
			pBuilder, err := newProviderBuilder(logCtx, manifest, client.GoPath())
			if err != nil {
				return nil, fmt.Errorf("%s: %w", desc.ModuleName, err)
			}

			pb.providerBuilders[pName] = pBuilder

		default:
			return nil, fmt.Errorf("unknow plugin type: %s", manifest.Type)
		}
	}

	for pName, desc := range localPlugins {
		manifest, err := ReadManifest(localGoPath, desc.ModuleName)
		if err != nil {
			return nil, fmt.Errorf("%s: failed to read manifest: %w", desc.ModuleName, err)
		}

		logger := log.With().
			Str("plugin", "plugin-"+pName).
			Str("module", desc.ModuleName).
			Str("runtime", manifest.Runtime).
			Logger()
		logCtx := logger.WithContext(ctx)

		switch manifest.Type {
		case typeMiddleware:
			middleware, err := newMiddlewareBuilder(logCtx, localGoPath, manifest, desc.ModuleName)
			if err != nil {
				return nil, err
			}

			pb.middlewareBuilders[pName] = middleware

		case typeProvider:
			builder, err := newProviderBuilder(logCtx, manifest, localGoPath)
			if err != nil {
				return nil, fmt.Errorf("%s: %w", desc.ModuleName, err)
			}

			pb.providerBuilders[pName] = builder

		default:
			return nil, fmt.Errorf("unknow plugin type: %s", manifest.Type)
		}
	}
	return pb, nil
}