Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
faker go library usage sample.
package main
import (
"fmt"
"github.com/bxcodec/faker"
)
type pixel struct {
R, G, B uint8
A uint8 `faker:"oneof: 254, 255"`
}
func (p *pixel) lesser(q pixel) bool {
if p.A == 255 && p.R < q.R && p.G < q.G && p.B < q.B {
fmt.Println(p)
return true
}
return false
}
func main() {
foo := [1e3]pixel{}
err := faker.FakeData(&foo)
if err != nil {
panic(err)
}
for _, x := range foo {
t := pixel{22, 22, 22, 22}
if x.lesser(t) {
fmt.Println("ok")
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.