deplist

package module
v1.0.30 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

README

Tests

deplist

Scan and list the dependencies in a source code repository.

Supports:

  • Go
  • NodeJS
  • Python
  • Ruby
  • Java

Dependencies are printed in PackageURL format.

Requirements

On Fedora:

$ dnf install golang-bin yarnpkg maven rubygem-bundler ruby-devel gcc gcc-c++ npm

Command Line

Build from source
$ make
go build cmd/deplist/deplist.go
Run
$ ./deplist test/testRepo
pkg:npm/d3-scale-chromatic@2.0.0
pkg:npm/d3-time@2.0.0
pkg:npm/prop-types@15.7.2
pkg:npm/react@16.13.1
...

Verbose/debug output:

 deplist -debug ./test/testRepo/
DEBU[0000] Checking ./test/testRepo/
DEBU[0000] GetRubyDeps test/testRepo/Gemfile
DEBU[0000] Running env [--chdir=test/testRepo ruby /tmp/gemfile-parser.rb927489446 .]
DEBU[0000] GetGoPkgDeps test/testRepo/Gopkg.lock
DEBU[0000] GetGlideDeps test/testRepo/glide.lock
DEBU[0000] GetGolangDeps test/testRepo/go.mod
...

API

The api functions as follows:

func GetDeps(fullPath string) ([]Dependency, Bitmask, error) {
Parameters
  • fullPath:

    Path to directory with source code.

Returns
  • Depenency:

    Array of Dependency structs from dependencies.go

  • Bitmask:

    A bitmask of found languages:

const (
	LangGolang = 1 << iota
	LangNodeJS
	LangPython
	LangRuby
)
  • error:

    Standard Go error handling

Documentation

Index

Constants

View Source
const (
	LangGolang = 1 << iota
	LangJava
	LangNodeJS
	LangPython
	LangRuby
)

enums start at 1 to allow us to specify found languages 0 = nil

Variables

This section is empty.

Functions

func GetDeps

func GetDeps(fullPath string) ([]Dependency, Bitmask, error)

GetDeps scans a given repository and returns all dependencies found in a DependencyList struct.

func GetLanguageStr

func GetLanguageStr(bm Bitmask) string

GetLanguageStr returns from a bitmask return the ecosystem name

Types

type Bitmask

type Bitmask uint32

Bitmask type allows easy tagging of what langs there are

func (*Bitmask) DepFoundAddFlag

func (f *Bitmask) DepFoundAddFlag(flag Bitmask)

DepFoundAddFlag add a lang type to the bitmask

func (Bitmask) DepFoundHasFlag

func (f Bitmask) DepFoundHasFlag(flag Bitmask) bool

DepFoundHasFlag deteremine if bitmask has a lang type

type Dependency

type Dependency struct {
	DepType Bitmask  // golang, nodejs, python etc
	Path    string   // the module path, github.com/teris-io/shortid
	Version string   // v0.0.0-20171029131806-771a37caa5cf
	Files   []string // if available, list of all files for a package

}

Dependency per dependency info

type Discovered added in v1.0.30

type Discovered struct {
	// contains filtered or unexported fields
}

Directories

Path Synopsis
cmd
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL