Here's a nice little lick that uses the pentatonic scale for each "chord of the moment". When the G chord is being played, a G major pentatonic scale is used, and the same is true for when the D chord is played. Since you're in the key of G here the 'I' chord is G and the 'V' chord is D.