Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

bugfix(faker): don't panic on typed array #99

Merged
merged 2 commits into from
Jun 7, 2020

Conversation

xaionaro
Copy link
Contributor

go fmt + fixed error:

$ cat > /tmp/1.go <<EOF
package main
import "github.com/bxcodec/faker"
type array [16]byte
func main() {
        var a array
        faker.FakeData(&a)
}
EOF

$ go run /tmp/1.go
panic: reflect.MakeSlice of non-slice type

goroutine 1 [running]:
reflect.MakeSlice(0x53d860, 0x4eed00, 0xd, 0xd, 0x0, 0x0, 0x0)
        /home/xaionaro/.gimme/versions/go1.13.linux.amd64/src/reflect/value.go:2256 +0x1d8
github.com/bxcodec/faker.getValue(0x4eed00, 0xc0000163a0, 0x191, 0x4eed01, 0x4eed00, 0xc0000163a0, 0x20300000000000)
        /home/xaionaro/go/src/github.com/bxcodec/faker/faker.go:444 +0xca0
github.com/bxcodec/faker.getValue(0x4dea40, 0xc000016380, 0xc00000e240, 0xc00000e220, 0x40c556, 0xc00000e1e0, 0xc00000e1c0)
        /home/xaionaro/go/src/github.com/bxcodec/faker/faker.go:355 +0x169e
github.com/bxcodec/faker.FakeData(0x4dea40, 0xc000016380, 0x56e00, 0xc0000240b8)
        /home/xaionaro/go/src/github.com/bxcodec/faker/faker.go:280 +0x1c6
main.main()
        /tmp/1.go:6 +0x3d
exit status 2

@codecov
Copy link

codecov bot commented May 29, 2020

Codecov Report

Merging #99 into master will decrease coverage by 0.15%.
The diff coverage is 80.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #99      +/-   ##
==========================================
- Coverage   94.90%   94.75%   -0.16%     
==========================================
  Files          10       10              
  Lines        1001     1010       +9     
==========================================
+ Hits          950      957       +7     
- Misses         28       29       +1     
- Partials       23       24       +1     
Impacted Files Coverage Δ
faker.go 90.42% <80.00%> (-0.25%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 627121e...eaf3a5c. Read the comment docs.

Copy link
Owner

@bxcodec bxcodec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't push to your branch, so can you help to resolve the conflict, please?

@bxcodec
Copy link
Owner

bxcodec commented Jun 4, 2020

Will released v3.4.0 after this PR fixed

Signed-off-by: Dmitry Yu Okunev <xaionaro@dx.center>
Fixed error:
```
$ cat > /tmp/1.go <<EOF
package main
import "github.com/bxcodec/faker"
type array [16]byte
func main() {
        var a array
        faker.FakeData(&a)
}
EOF

$ go run /tmp/1.go
panic: reflect.MakeSlice of non-slice type

goroutine 1 [running]:
reflect.MakeSlice(0x53d860, 0x4eed00, 0xd, 0xd, 0x0, 0x0, 0x0)
        /home/xaionaro/.gimme/versions/go1.13.linux.amd64/src/reflect/value.go:2256 +0x1d8
github.com/bxcodec/faker.getValue(0x4eed00, 0xc0000163a0, 0x191, 0x4eed01, 0x4eed00, 0xc0000163a0, 0x20300000000000)
        /home/xaionaro/go/src/github.com/bxcodec/faker/faker.go:444 +0xca0
github.com/bxcodec/faker.getValue(0x4dea40, 0xc000016380, 0xc00000e240, 0xc00000e220, 0x40c556, 0xc00000e1e0, 0xc00000e1c0)
        /home/xaionaro/go/src/github.com/bxcodec/faker/faker.go:355 +0x169e
github.com/bxcodec/faker.FakeData(0x4dea40, 0xc000016380, 0x56e00, 0xc0000240b8)
        /home/xaionaro/go/src/github.com/bxcodec/faker/faker.go:280 +0x1c6
main.main()
        /tmp/1.go:6 +0x3d
exit status 2
```

Signed-off-by: Dmitry Yu Okunev <xaionaro@dx.center>
@xaionaro
Copy link
Contributor Author

xaionaro commented Jun 6, 2020

@bxcodec reapplied the patch over the recent master (it should solve the conflict).

Will released v3.4.0 after this PR fixed

Thank you :)

Copy link
Owner

@bxcodec bxcodec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bxcodec bxcodec merged commit a67194d into bxcodec:master Jun 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants