From 8d0997cd8d6ee7966f08bf006f2e43cc6812871c Mon Sep 17 00:00:00 2001 From: Ritesh Noronha Date: Wed, 2 Oct 2024 23:21:10 -0700 Subject: [PATCH] remove unused file --- pkg/assemble/cdx/comp_service.go | 89 -------------------------------- 1 file changed, 89 deletions(-) delete mode 100644 pkg/assemble/cdx/comp_service.go diff --git a/pkg/assemble/cdx/comp_service.go b/pkg/assemble/cdx/comp_service.go deleted file mode 100644 index e465c3d..0000000 --- a/pkg/assemble/cdx/comp_service.go +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright 2023 Interlynk.io -// -// SPDX-License-Identifier: Apache-2.0 -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package cdx - -import ( - "context" - - cydx "github.com/CycloneDX/cyclonedx-go" - "github.com/interlynk-io/sbomasm/pkg/logger" -) - -type idmap struct { - oldID string - newID string -} - -type ComponentService struct { - ctx context.Context - idList []idmap -} - -func newComponentService(ctx context.Context) *ComponentService { - return &ComponentService{ - ctx: ctx, - idList: []idmap{}, - } -} - -func (s *ComponentService) StoreAndCloneWithNewID(c *cydx.Component) *cydx.Component { - //log := logger.FromContext(s.ctx) - if c == nil { - return nil - } - - nc, err := cloneComp(c) - if err != nil { - panic(err) - } - - newID := newBomRef() - nc.BOMRef = newID - - s.idList = append(s.idList, idmap{ - oldID: c.BOMRef, - newID: newID, - }) - - return nc -} - -func (s *ComponentService) ResolveDepID(depID string) (string, bool) { - for _, v := range s.idList { - if v.oldID == depID { - return v.newID, true - } - } - return "", false -} - -func (s *ComponentService) ResolveDepIDs(depIDs []string) []string { - ids := []string{} - for _, depID := range depIDs { - if id, ok := s.ResolveDepID(depID); ok { - ids = append(ids, id) - } - } - return ids -} - -func (s *ComponentService) Dump() { - log := logger.FromContext(s.ctx) - for _, v := range s.idList { - log.Debugf("%s %s", v.newID, v.oldID) - } -}