unit – how to enable and disable objects with a certain tag in C #?

I have a script that is supposed to find every active object with a given tag and, by pressing a button, turn on and off its meshrenderer and collider. but the script only tries to turn on and off the previous one on the object to which the script is attached. What am I doing wrong and is there a feasible way to do it?
here is the script:

private bool on = true;

Empty public update ()
{
GameObject[] gameObjectArray = GameObject.FindGameObjectsWithTag ("buildnode");


if (Input.GetKeyDown ("b"))
{
on =! we;
}



if (on == false)
{
foreach (GameObject goes into GameObject.FindGameObjectsWithTag ("buildnode"))
{
go.GetComponent() .enabled = false;
go.GetComponent() .enabled = false;
}
}

if (the true ==)
{
foreach (GameObject goes into GameObject.FindGameObjectsWithTag ("buildnode"))
{
go.GetComponent() .enabled = true;
go.GetComponent() .enabled = true;
}
}
}

Thank you and good day.