Try this with main.go. In your greeter directory, run the following command:

go build
If you are running macOS or Linux, you will find a new executable file that has been named after the directory in which you built your program:

Outputgreeter  main.go
The output of the binary will match the output from when you ran the program with go run:

OutputHello, World!
Now, that you’ve created your executable, run it to make sure the binary has been built correctly. On macOS or Linux, run the following command:

./greeter
In this case, you built your greeter application into an executable file that was added to your current directory. Check this by running the ls command:

ls

Recommend

How To Build and Install Go Programs Step 2 — Creating a Go Module to Build a Go Binary

How To Build and Install Go Programs Step 1 — Setting Up and Running the Go Binary

How To Set Up Let's Encrypt with Nginx Server Blocks on Ubuntu 16.04 Conclusion Want to learn more? Join the DigitalOcean Community! Still looking for an answer?

How To Set Up Let's Encrypt with Nginx Server Blocks on Ubuntu 16.04 Step 5 — Verifying Certbot Auto-Renewal

How To Set Up Let's Encrypt with Nginx Server Blocks on Ubuntu 16.04 Step 4 — Obtaining an SSL Certificate

How To Set Up Let's Encrypt with Nginx Server Blocks on Ubuntu 16.04 Step 3 — Allowing HTTPS Through the Firewall

How To Set Up Let's Encrypt with Nginx Server Blocks on Ubuntu 16.04 Step 2 — Confirming Nginx’s Configuration

How To Set Up Let's Encrypt with Nginx Server Blocks on Ubuntu 16.04 Step 1 — Installing Certbot

Comment utiliser Go avec MongoDB en utilisant le pilote MongoDB Go Étape 8 — Suppression d’une tâche

Comment utiliser Go avec MongoDB en utilisant le pilote MongoDB Go Étape 7 — Affichage des tâches terminées

Comment utiliser Go avec MongoDB en utilisant le pilote MongoDB Go Étape 6 — Affichage des tâches en attente uniquement

Comment utiliser Go avec MongoDB en utilisant le pilote MongoDB Go Étape 5 — Fin d’une tâche

Comment utiliser Go avec MongoDB en utilisant le pilote MongoDB Go Étape 4 — Liste de toutes les tâches

Comment utiliser Go avec MongoDB en utilisant le pilote MongoDB Go Étape 3 — Création d’une tâche

Comment utiliser Go avec MongoDB en utilisant le pilote MongoDB Go Étape 2 — Création d’un programme CLI

Comment utiliser Go avec MongoDB en utilisant le pilote MongoDB Go Étape 1 — Installation du pilote Go de MongoDB

Comment utiliser Go avec MongoDB en utilisant le pilote MongoDB Go Conditions préalables

Como instalar o Linux, o Nginx, o MySQL e a pilha PHP (LEMP) no CentOS 8 [Início rápido] Passo 4 — Testar o PHP com o Nginx

Como instalar o Linux, o Nginx, o MySQL e a pilha PHP (LEMP) no CentOS 8 [Início rápido] Passo 3 — Instalar o PHP-FPM

Como instalar o Linux, o Nginx, o MySQL e a pilha PHP (LEMP) no CentOS 8 [Início rápido] Passo 2 — Instalar o MariaDB

Como instalar o Linux, o Nginx, o MySQL e a pilha PHP (LEMP) no CentOS 8 [Início rápido] Passo 1 — Instalar o Nginx

Lidando com a função Panics em Go Detectando panics com o recover

Lidando com a função Panics em Go Lidando com os panics

Lidando com a função Panics em Go Funções adiadas