Using Raycast and not getting proper output

Having an issue using Raycast to detect a GameObject when the player looks at it. here is my code and it will compile and run with no errors, but won’t return anything when I look at a cube that I have tagged with the name “enemy”. Thanks in advance folks.

using UnityEngine;
using System.Collections;

public class bulletShoot : MonoBehaviour 
{

	// Use this for initialization
	void Start () 
	{
		
	}
	
	// Update is called once per frame
	void Update () 
	{
		float distanceToGround = 0.0f;
		RaycastHit hit;
		if (Physics.Raycast (transform.position, -Vector3.up, out hit, 100.0f)) 
		{
			distanceToGround = hit.distance;
			if(hit.Equals(GameObject.FindGameObjectWithTag("enemy")))
			{
				Debug.Log("You have hit the enemy");
				Debug.Log("Distance to enemy: ");
				Debug.Log(distanceToGround);
			}
		}	
	}
}

This line seems wrong:

if(hit.Equals(GameObject.FindGameObjectWithTag("enemy")))

A RaycastHit is probably never going to equal a GameObject. Even if it might, do you have more than one GameObject named “enemy”? There’s no guarantee that FindGameObjectWithTag would return the one you’re interested in.

If you just want to check if the hit object is named “enemy”, this would be simpler:

if (hit.transform.name == "enemy")

Or if you really want to use a tag:

if (hit.transform.gameObject.tag == "enemy")
if (hit.collider.tag == "enemy")