Skip to content

Commit 05bdddc

Browse files
Merge pull request #25 from frictionlessdata/fixRemoveResource
Fixing Package.RemoveSource
2 parents 8b21747 + c2ec875 commit 05bdddc

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

datapackage/package.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ func (p *Package) RemoveResource(name string) {
106106
}
107107
}
108108
if index > -1 {
109-
newSlice := append(rSlice[:index], rSlice[:index+1]...)
109+
newSlice := append(rSlice[:index], rSlice[index+1:]...)
110110
r, err := buildResources(newSlice, p.basePath, p.valRegistry)
111111
if err != nil {
112112
return

datapackage/package_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,9 @@ func TestPackage_RemoveResource(t *testing.T) {
169169

170170
resDesc := pkg.descriptor["resources"].([]interface{})
171171
is.Equal(len(resDesc), 1)
172-
is.Equal(resDesc[0], r1Filled)
172+
is.Equal(resDesc[0], r2Filled)
173173
is.Equal(len(pkg.resources), 1)
174-
is.Equal(pkg.resources[0].name, "res1")
174+
is.Equal(pkg.resources[0].name, "res2")
175175
})
176176
t.Run("NonExisting", func(t *testing.T) {
177177
is := is.New(t)

go.sum

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
github.com/frictionlessdata/tableschema-go v0.1.5-0.20190521014818-f9bf38926664 h1:IvuZMJ6dH1ye2bWmM8Yla6jj1xIPBR/nZJlm6P4ZSD4=
22
github.com/frictionlessdata/tableschema-go v0.1.5-0.20190521014818-f9bf38926664/go.mod h1:OfuE6zbfQdlwx5q9vf5XWXEGJ0LYZcd9ML3zme5rP3k=
33
github.com/matryer/is v0.0.0-20170112134659-c0323ceb4e99/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA=
4+
github.com/matryer/is v1.2.0 h1:92UTHpy8CDwaJ08GqLDzhhuixiBUUD1p3AU6PHddz4A=
45
github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA=
56
github.com/santhosh-tekuri/jsonschema v1.2.4 h1:hNhW8e7t+H1vgY+1QeEQpveR6D4+OwKPXCfD2aieJis=
67
github.com/santhosh-tekuri/jsonschema v1.2.4/go.mod h1:TEAUOeZSmIxTTuHatJzrvARHiuO9LYd+cIxzgEHCQI4=

0 commit comments

Comments
 (0)