Since both private and public Go modules are source repositories, publishing a private Go module follows the same process as publishing a public one. To publish your new module, stage your changes in the current directory using the git add command, then commit those changes to your local repository with the git commit command:

git add .
git commit -m "Initial private module implementation"
Now that your module is created, it’s time to add a function you can use from another project. Use nano, or your favorite text editor, to open a file with the same name as your repository, such as mysecret.go. The name isn’t significant, and could be anything, but using the same name as the repository makes it easier to determine which file to look in first when working with a new module:

nano mysecret.go
Next, use cd to go into the new mysecret directory you cloned and use go mod init, along with the name of your private repository, to create a new Go module:

cd mysecret
go mod init github.com/your_github_username/mysecret
You will see a confirmation from Git that your initial commit has succeeded as well as a summary of the files included in the commit:

Output[main (root-commit) bda059d] Initial private module implementation
 2 files changed, 10 insertions(+)
 create mode 100644 go.mod
 create mode 100644 mysecret.go
From the projects directory, run git clone to clone your private mysecret repository to your computer:

git clone git@github.com:your_github_username/mysecret.git
Git will then push your changes and make them available to anyone with access to your private repository:

git push origin main
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 8 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (4/4), 404 bytes | 404.00 KiB/s, done.
Total 4 (delta 0), reused 0 (delta 0), pack-reused 0
To github.com:your_github_username/mysecret.git
 * [new branch]      main -> main
Make the projects directory and navigate to it:

mkdir projects
cd projects
Git will confirm it has cloned your module and may warn you that you have cloned an empty repository. If so, this is not something you need to worry about:

OutputCloning into 'mysecret'...
warning: You appear to have cloned an empty repository.
Now the only part left is to move your changes to your GitHub repository. Similar to a public module, use the git push command to publish your code:

git push
projects/mysecret/mysecret.go

package mysecret

import "fmt"

func SecretProcess() {
	fmt.Println("Running the secret process!")
}

Recommend

How to Use a Private Go Module in Your Own Project Distributing a Private Module

Cómo usar Visual Studio Code para desarrollo remoto a través del complemento Remote-SSH Paso 3: Ejecutar código en el servidor remoto

Cómo usar Visual Studio Code para desarrollo remoto a través del complemento Remote-SSH Paso 2: Configurar el complemento Remote-SSH y establecer conexión con su servidor

Индексация, разделение и управление строками в JavaScript Поиск и замена значений строк

Индексация, разделение и управление строками в JavaScript Примитивы и объекты String

Comment packager et publier une application Snap sur Ubuntu 18.04 Étape 6 - Publication de votre Snap

Comment packager et publier une application Snap sur Ubuntu 18.04 Étape 5 - Construction et test de votre application Snap

Comment packager et publier une application Snap sur Ubuntu 18.04 Étape 3 - Définition de la configuration et des métadonnées pour votre Snap

Comment packager et publier une application Snap sur Ubuntu 18.04 Étape 2 - Installation de Snapcraft

Comment packager et publier une application Snap sur Ubuntu 18.04 Étape 1 - Préparation de votre application pour le packaging

How To Install Linux, Apache, MariaDB, PHP (LAMP) Stack on CentOS 8 Step 5 — Testing Database Connection from PHP (Optional)

How To Install Linux, Apache, MariaDB, PHP (LAMP) Stack on CentOS 8 Step 4 — Testing PHP with Apache

How To Install Linux, Apache, MariaDB, PHP (LAMP) Stack on CentOS 8 Step 3 — Installing PHP

How To Install Linux, Apache, MariaDB, PHP (LAMP) Stack on CentOS 8 Step 2 — Installing MariaDB

How To Install Linux, Apache, MariaDB, PHP (LAMP) Stack on CentOS 8 Step 1 — Installing the Apache Web Server

Como Instalar o Go no Ubuntu 18.04 Passo 3 — Testando Sua Instalação