From 0baa4de52785fbee6bda38596011b6073b01c48a Mon Sep 17 00:00:00 2001 From: Brian Fitzwater - IDI-C Date: Mon, 18 Nov 2019 13:06:36 -0500 Subject: [PATCH 1/2] Fix run time error (Closes #18) --- handler/helpers/accounts/accounts.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/handler/helpers/accounts/accounts.go b/handler/helpers/accounts/accounts.go index bfba0b3..224be2a 100644 --- a/handler/helpers/accounts/accounts.go +++ b/handler/helpers/accounts/accounts.go @@ -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 { @@ -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 == "": From 7af0572bf992b879c355f987bb1d8853d0e8b1cd Mon Sep 17 00:00:00 2001 From: Brian Fitzwater - IDI-C Date: Mon, 18 Nov 2019 13:25:48 -0500 Subject: [PATCH 2/2] Disable gomnd linter --- handler/.golangci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/handler/.golangci.yml b/handler/.golangci.yml index de8a7df..772d1dd 100644 --- a/handler/.golangci.yml +++ b/handler/.golangci.yml @@ -125,6 +125,7 @@ linters: - gochecknoinits - gochecknoglobals - wsl + - gomnd fast: false # Independently from option `exclude` we use default exclude patterns,