From a5bc1aeb3cfdbdeb64b4e2778ee28f3ba1f64b91 Mon Sep 17 00:00:00 2001 From: Volkov Date: Mon, 4 Feb 2019 13:52:07 +0200 Subject: [PATCH] fix lint problem - method complexity --- internal/artifacts/manifest.go | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/internal/artifacts/manifest.go b/internal/artifacts/manifest.go index ec06a8740..49ab93aa1 100644 --- a/internal/artifacts/manifest.go +++ b/internal/artifacts/manifest.go @@ -62,16 +62,8 @@ func setManifestDesc(ep dir.ITargetArtifacts, targetPathGetter dir.ITargetPath, return errors.Wrapf(err, "failed to generate the manifest file when getting the %s module content type", mod.Name) } - modulePath := getModulePath(mod, targetPathGetter) - if modulePath != "" { - moduleEntry := entry{ - EntryName: mod.Name, - EntryPath: modulePath, - ContentType: contentType, - EntryType: moduleEntry, - } - entries = append(entries, moduleEntry) - } + + entries = addModuleEntry(targetPathGetter, entries, mod, contentType) if onlyModules { continue @@ -98,6 +90,21 @@ func setManifestDesc(ep dir.ITargetArtifacts, targetPathGetter dir.ITargetPath, return genManifest(ep.GetManifestPath(), entries) } +func addModuleEntry(targetPathGetter dir.ITargetPath, entries []entry, module *mta.Module, contentType string) []entry { + result := entries + modulePath := getModulePath(module, targetPathGetter) + if modulePath != "" { + moduleEntry := entry{ + EntryName: module.Name, + EntryPath: modulePath, + ContentType: contentType, + EntryType: moduleEntry, + } + result = append(entries, moduleEntry) + } + return result +} + func getResourcesEntries(targetPathGetter dir.ITargetPath, resources []*mta.Resource, contentTypes *contenttype.ContentTypes) ([]entry, error) { var entries []entry