Dog food does have a shelf life of around 1 year but it doesn't mean the dog food will be bad for your dog to eat.
It's just a general guideline that the pet food manufactures must put on their dog food and cat food.
Check the best by date on the bag of dog food you want to buy and see when it expires.
If it's more than 2 years old then I wouldn't feed it to the dog if you're worried. But if the dog food has only been expired a little over a year then I wouldn't worry about it.