Skip to content

Commit

Permalink
Merge pull request #19 from GSA/issue_18
Browse files Browse the repository at this point in the history
Fix run time error (Closes #18)
  • Loading branch information
Brian Fitzwater - IDI-C authored Nov 20, 2019
2 parents 956f8a4 + 7af0572 commit 33ff4c5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions handler/.golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ linters:
- gochecknoinits
- gochecknoglobals
- wsl
- gomnd
fast: false

# Independently from option `exclude` we use default exclude patterns,
Expand Down
10 changes: 7 additions & 3 deletions handler/helpers/accounts/accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ type Options struct {
// Global compiled regular expressions
var rIDList = regexp.MustCompile(`^\d{12}(,\d{12})*$`)

// Svc ... type for holding session/config and AWS services
// For unit testing, set the iamSvc, organizationsSvc and downloaderSvc to
// an iface mock svc client
type Svc struct {
Expand All @@ -57,16 +58,19 @@ type Svc struct {
downloaderSvc s3manageriface.DownloaderAPI
}

// NewAccountsSvc ... creates new Svc struct
func NewAccountsSvc(cfg client.ConfigProvider) (as *Svc, err error) {
if cfg == nil {
return nil, errors.New("nil ConfigProvider")
}
as.cfg = cfg
as.downloaderSvc = s3manager.NewDownloader(cfg)
as = &Svc{
cfg: cfg,
downloaderSvc: s3manager.NewDownloader(cfg),
}
return as, nil
}

// Accounts ... performs Queries or parses accounts and returns all organization accounts
// AccountsList ... performs Queries or parses accounts and returns all organization accounts
func (as *Svc) AccountsList(opt Options) ([]*organizations.Account, error) {
switch str := opt.AccountsInfo; {
case str == "":
Expand Down

0 comments on commit 33ff4c5

Please sign in to comment.