Skip to content

Import Cycle Not Allowed #132

@asponzan

Description

@asponzan

I'm new to Golang so I may have missed or messed up but I'm recieving a import cycle not allowed error when trying to use this packge with the decode example

Error I'm receiving:

package command-line-arguments
        imports github.com/CycloneDX/cyclonedx-go
        imports github.com/CycloneDX/cyclonedx-go: import cycle not allowed
// main.go
package main

import (
	"fmt"
	"net/http"

	cdx "github.com/CycloneDX/cyclonedx-go"
)

func main() {
	// Acquire a BOM (e.g. by downloading it)
	res, err := http.Get("https://github.com/DependencyTrack/dependency-track/releases/download/4.1.0/bom.json")
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()

	// Decode the BOM
	bom := new(cdx.BOM)
	decoder := cdx.NewBOMDecoder(res.Body, cdx.BOMFileFormatJSON)
	if err = decoder.Decode(bom); err != nil {
		panic(err)
	}

	fmt.Printf("Successfully decoded BOM of %s\n", bom.Metadata.Component.PackageURL)
	fmt.Printf("- Generated: %s with %s\n", bom.Metadata.Timestamp, (*bom.Metadata.Tools.Tools)[0].Name)
	fmt.Printf("- Components: %d\n", len(*bom.Components))

}
//go.mod
module github.com/CycloneDX/cyclonedx-go

go 1.21.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions