Skip to content

Commit

Permalink
Merge pull request #25 from frictionlessdata/fixRemoveResource
Browse files Browse the repository at this point in the history
Fixing Package.RemoveSource
  • Loading branch information
danielfireman authored Feb 21, 2020
2 parents 8b21747 + c2ec875 commit 05bdddc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion datapackage/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func (p *Package) RemoveResource(name string) {
}
}
if index > -1 {
newSlice := append(rSlice[:index], rSlice[:index+1]...)
newSlice := append(rSlice[:index], rSlice[index+1:]...)
r, err := buildResources(newSlice, p.basePath, p.valRegistry)
if err != nil {
return
Expand Down
4 changes: 2 additions & 2 deletions datapackage/package_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,9 @@ func TestPackage_RemoveResource(t *testing.T) {

resDesc := pkg.descriptor["resources"].([]interface{})
is.Equal(len(resDesc), 1)
is.Equal(resDesc[0], r1Filled)
is.Equal(resDesc[0], r2Filled)
is.Equal(len(pkg.resources), 1)
is.Equal(pkg.resources[0].name, "res1")
is.Equal(pkg.resources[0].name, "res2")
})
t.Run("NonExisting", func(t *testing.T) {
is := is.New(t)
Expand Down
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
github.com/frictionlessdata/tableschema-go v0.1.5-0.20190521014818-f9bf38926664 h1:IvuZMJ6dH1ye2bWmM8Yla6jj1xIPBR/nZJlm6P4ZSD4=
github.com/frictionlessdata/tableschema-go v0.1.5-0.20190521014818-f9bf38926664/go.mod h1:OfuE6zbfQdlwx5q9vf5XWXEGJ0LYZcd9ML3zme5rP3k=
github.com/matryer/is v0.0.0-20170112134659-c0323ceb4e99/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA=
github.com/matryer/is v1.2.0 h1:92UTHpy8CDwaJ08GqLDzhhuixiBUUD1p3AU6PHddz4A=
github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA=
github.com/santhosh-tekuri/jsonschema v1.2.4 h1:hNhW8e7t+H1vgY+1QeEQpveR6D4+OwKPXCfD2aieJis=
github.com/santhosh-tekuri/jsonschema v1.2.4/go.mod h1:TEAUOeZSmIxTTuHatJzrvARHiuO9LYd+cIxzgEHCQI4=
Expand Down

0 comments on commit 05bdddc

Please sign in to comment.