Modulo que saluda
Parte del estudio de Go: https://go.dev/doc/
Al inicio no tengo go.mod
ni go.sum
. Ejecuto:
go mod init github.com/LuisPalacios/golang-greetings
go mod tidy
Verifico que pasa los tests
go test ./... ((o también "go test -v")
Publico mi primera versión inestable,
git add .
git commit -m "changes for v0.1.1"
git tag v0.1.1
Push del TAG a Origin
git push origin v0.1.1
Hago que el módulo esté disponible
go list -m github.com/LuisPalacios/golang-greetings@v0.1.1
En el proyecto que consume este módulo basta con incluir lo siguiente en su import
import (
// mi módulo
"github.com/LuisPalacios/golang-greetings"
)
Y por supuesto haber inicializado y hecho un mod tidy
go mod init luispa.com/hello
go mod tidy