Skip to content

Commit

Permalink
Fix lint. \o/
Browse files Browse the repository at this point in the history
  • Loading branch information
evankanderson committed Jun 12, 2024
1 parent 5db27a5 commit 061010e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions internal/config/server/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type ProviderConfig struct {
Git GitConfig `mapstructure:"git"`
}

// GitConfig provides server-side configuration for Git operations like "clone"
type GitConfig struct {
MaxFiles int64 `mapstructure:"max_files" default:"10000"`
MaxBytes int64 `mapstructure:"max_bytes" default:"100_000_000"`
Expand Down
4 changes: 3 additions & 1 deletion internal/providers/git/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const maxCachedObjectSize = 100 * 1024 // 100KiB
// Ensure that the Git client implements the Git interface
var _ provifv1.Git = (*Git)(nil)

// Options implements the "functional options" pattern for Git
type Options func(*Git)

// NewGit creates a new GitHub client
Expand All @@ -58,6 +59,7 @@ func NewGit(token provifv1.GitCredential, opts ...Options) *Git {
return ret
}

// WithConfig configures the Git implementation with server-side configuration options.
func WithConfig(cfg server.GitConfig) Options {
return func(g *Git) {
g.maxFiles = cfg.MaxFiles
Expand Down Expand Up @@ -121,7 +123,7 @@ func (g *Git) Clone(ctx context.Context, url, branch string) (*git.Repository, e
return nil, provifv1.ErrRepositoryEmpty
} else if errors.Is(err, memboxfs.ErrTooManyFiles) {
return nil, fmt.Errorf("%w: %w", provifv1.ErrRepositoryTooLarge, err)
}else if errors.Is(err, memboxfs.ErrTooBig) {
} else if errors.Is(err, memboxfs.ErrTooBig) {
return nil, fmt.Errorf("%w: %w", provifv1.ErrRepositoryTooLarge, err)
}
return nil, fmt.Errorf("could not clone repo: %w", err)
Expand Down
6 changes: 3 additions & 3 deletions internal/providers/git/memboxfs/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ import (
// LimitedFs provides a size-limited billy.Filesystem. This is a struct, there's
// no constructor here. Note that LimitedFs is not thread-safe.
type LimitedFs struct {
Fs billy.Filesystem
Fs billy.Filesystem
MaxFiles int64
TotalFileSize int64

currentFiles int64
currentSize int64
currentFiles int64
currentSize int64
}

// ErrNotImplemented is returned when a method is not implemented.
Expand Down

0 comments on commit 061010e

Please sign in to comment.