From 4688c2a3d506e5197c8c421278c76642ec6588ac Mon Sep 17 00:00:00 2001 From: Ashley Wang Date: Thu, 4 Feb 2021 12:10:33 -0500 Subject: [PATCH] backwards compatible NewManager (#11) * backwards compatible NewManager * changelog --- .../v0.0.3/new-manager-with-settings.yaml | 4 ++++ pkg/manager/protodep.go | 19 ++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 changelog/v0.0.3/new-manager-with-settings.yaml diff --git a/changelog/v0.0.3/new-manager-with-settings.yaml b/changelog/v0.0.3/new-manager-with-settings.yaml new file mode 100644 index 0000000..8c75929 --- /dev/null +++ b/changelog/v0.0.3/new-manager-with-settings.yaml @@ -0,0 +1,4 @@ +changelog: + - type: NEW_FEATURE + description: Use manager.NewManagerWithSettings to set up an anyvendor manager with a list of directories to skip. + issueLink: https://github.com/solo-io/anyvendor/issues/12 diff --git a/pkg/manager/protodep.go b/pkg/manager/protodep.go index 4e06e8a..f69ec53 100644 --- a/pkg/manager/protodep.go +++ b/pkg/manager/protodep.go @@ -22,7 +22,24 @@ type Manager struct { depFactories []depFactory } -func NewManager(ctx context.Context, settings *anyvendor.FactorySettings) (*Manager, error) { +func NewManager(ctx context.Context, cwd string) (*Manager, error) { + if ctx == nil { + ctx = context.Background() + } + goMod, err := NewGoModFactory(&anyvendor.FactorySettings{ + Cwd: cwd, + }) + if err != nil { + return nil, err + } + return &Manager{ + depFactories: []depFactory{ + goMod, + }, + }, nil +} + +func NewManagerWithSettings(ctx context.Context, settings *anyvendor.FactorySettings) (*Manager, error) { if ctx == nil { ctx = context.Background() }