Skip to content

Commit

Permalink
Limit the length of the RequestedBy field (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
talarian1 authored Feb 22, 2022
1 parent bae5597 commit 297d97d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions build/golang.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,13 @@ func populateZip(packageId, zipPath string) (zipDependency entities.Dependency,
func populateRequestedByField(parentId string, parentRequestedBy [][]string, dependenciesMap map[string]entities.Dependency, dependenciesGraph map[string][]string) {
for _, childName := range dependenciesGraph[parentId] {
if childDep, ok := dependenciesMap[childName]; ok {
if childDep.NodeHasLoop() || len(childDep.RequestedBy) >= entities.RequestedByMaxLength {
continue
}
for _, requestedBy := range parentRequestedBy {
childRequestedBy := append([]string{parentId}, requestedBy...)
childDep.RequestedBy = append(childDep.RequestedBy, childRequestedBy)
}
if childDep.NodeHasLoop() {
continue
}
// Reassign map entry with new entry copy
dependenciesMap[childName] = childDep
// Run recursive call on child dependencies
Expand Down
5 changes: 3 additions & 2 deletions entities/buildinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ import (
type ModuleType string

const (
TimeFormat = "2006-01-02T15:04:05.000-0700"
BuildInfoEnvPrefix = "buildInfo.env."
TimeFormat = "2006-01-02T15:04:05.000-0700"
BuildInfoEnvPrefix = "buildInfo.env."
RequestedByMaxLength = 10

// Build type
Build ModuleType = "build"
Expand Down

0 comments on commit 297d97d

Please sign in to comment.