go compile for raspberry pi

# Step 1: Install Go for Raspberry Pi
sudo apt update
sudo apt install golang

# Step 2: Set Go environment variables
echo 'export GOPATH=$HOME/go' >> ~/.profile
echo 'export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin' >> ~/.profile
source ~/.profile

# Step 3: Create a Go project directory
mkdir ~/go/src/myproject
cd ~/go/src/myproject

# Step 4: Write your Go code (e.g., main.go)
nano main.go

# Step 5: Compile Go code for Raspberry Pi
env GOOS=linux GOARCH=arm GOARM=7 go build

# Step 6: Transfer the executable to your Raspberry Pi (replace 'raspberrypi' with your Pi's IP address)
scp ./myproject pi@raspberrypi:/home/pi/

# Step 7: SSH into your Raspberry Pi
ssh pi@raspberrypi

# Step 8: Run the executable on Raspberry Pi
./myproject