Like many other nuts, walnuts aren't super good for dogs, but a very small amount probably won't harm them.
Additionally, if your dog consumes a moldy walnut (or any other type of moldy nut), call your vet.
Moldy walnuts and other moldy nuts can contain tremorgenic mycotoxins, which can cause seizures in dogs.