Let (R,m, k) be a noetherian local ring. It is well-known that R is regular if and only if the injective dimension of k is finite. In this paper it is shown that R is Gorenstein if and only if the Gorenstein injective dimension of k is finite. On the other hand a generalized version of the so-called Bass formula is proved for finitely generated modules of finite Gorenstein injective dimension. ...