Operator '==' cannot be applied to operands of type 'int' and 'string

I was creating a script to find all gameObjects with a certain layer but in the if statement I get an error:
“Operator ‘==’ cannot be applied to operands of type ‘int’ and 'string”. Any solution?

GameObject gos = GameObject.FindObjectsOfType(typeof(GameObject)) as GameObject;

        foreach (GameObject go in gos)
        {
            if(go.layer == "Player")
            {

            }
        }

go.layer returns the integer ID of the layer. You can find your layers ID by going Edit → Project Settings → Tags & Layers and it will appear in the inspectoralt text

Simply plug that number in instead of the layer name. - ie. if you wanted the Water Layer you would do

if(go.layer == 4)