Skip to content

Commit

Permalink
feat(hook): skip system installed Go binaries (#481)
Browse files Browse the repository at this point in the history
  • Loading branch information
knqyf263 authored Apr 22, 2022
1 parent c887d9e commit d23a952
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 6 deletions.
3 changes: 3 additions & 0 deletions hook/filter/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ var (

// node.js
types.NodePkg,

// Go binaries
types.GoBinary,
}
)

Expand Down
33 changes: 27 additions & 6 deletions hook/filter/filter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,11 @@ func Test_systemFileFilterHook_Hook(t *testing.T) {
want: &types.BlobInfo{},
},
{
name: "go is not affected",
name: "go binaries",
blob: &types.BlobInfo{
Applications: []types.Application{
{
Type: "gobinary",
Type: types.GoBinary,
FilePath: "usr/local/bin/goreleaser",
Libraries: []types.Package{
{
Expand All @@ -210,15 +210,36 @@ func Test_systemFileFilterHook_Hook(t *testing.T) {
"usr/local/bin/goreleaser",
},
},
want: &types.BlobInfo{},
},
{
name: "Rust will not be skipped",
blob: &types.BlobInfo{
Applications: []types.Application{
{
Type: types.Cargo,
FilePath: "app/Cargo.lock",
Libraries: []types.Package{
{
Name: "ghash",
Version: "0.4.4",
},
},
},
},
SystemFiles: []string{
"app/Cargo.lock",
},
},
want: &types.BlobInfo{
Applications: []types.Application{
{
Type: "gobinary",
FilePath: "usr/local/bin/goreleaser",
Type: types.Cargo,
FilePath: "app/Cargo.lock",
Libraries: []types.Package{
{
Name: "github.com/sassoftware/go-rpmutils",
Version: "v0.0.0-20190420191620-a8f1baeba37b",
Name: "ghash",
Version: "0.4.4",
},
},
},
Expand Down

0 comments on commit d23a952

Please sign in to comment.