This repository has been archived by the owner on Nov 23, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
11,530 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package scan | ||
|
||
import ( | ||
"io/ioutil" | ||
"path/filepath" | ||
|
||
log "github.com/sirupsen/logrus" | ||
"gopkg.in/yaml.v3" | ||
) | ||
|
||
type GlideDeps struct { | ||
Name string | ||
Version string | ||
} | ||
|
||
type glideDep struct { | ||
Name string `yaml:"name"` | ||
Version string `yaml:"version"` | ||
Subpackages []string `yaml:"subpackages"` | ||
} | ||
|
||
type glideDeps struct { | ||
Imports []glideDep | ||
} | ||
|
||
func GetGlideDeps(path string) ([]GlideDeps, error) { | ||
log.Debugf("GetGlideDeps %s", path) | ||
|
||
var deps glideDeps | ||
var gathered []GlideDeps | ||
|
||
yaml_file, err := ioutil.ReadFile(path) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
err = yaml.Unmarshal(yaml_file, &deps) | ||
|
||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
for _, d := range deps.Imports { | ||
gathered = append(gathered, | ||
GlideDeps{ | ||
Name: d.Name, | ||
Version: d.Version, | ||
}, | ||
) | ||
|
||
for _, subpackage := range d.Subpackages { | ||
gathered = append(gathered, | ||
GlideDeps{ | ||
Name: filepath.Join(d.Name, subpackage), | ||
Version: d.Version, | ||
}, | ||
) | ||
} | ||
} | ||
|
||
return gathered, nil | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.