What happens if you write out a major scale and try to figure out the chords in it? There’s a simple formula to figure this out. Simply take the 1st,3rd,5th and 7th notes of the scale, which in the the key of G is G,B,D,F#, and you can create the first chord which is Gmaj7.
To figure out the next chord you use the same formula (1,3,5,7) but start on the second note of the scale which is A. This yields A, C, E, G which is Amin7.
If you continue this process for each note of the scale you will get the chords in the diagram below. Check it out.G Major Diatonic Chord Scale