1d45f232c6
Funciones impuras para gestión de contenedores: docker_build_image, docker_compose_up/down, docker_volume_create/list/remove, generate_dockerfile, write_dockerfile, go_build_binary, health_check_http, deploy_app y stop_app. Todas con tests unitarios donde aplica. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1.5 KiB
1.5 KiB
name, kind, lang, domain, version, purity, signature, description, tags, uses_functions, uses_types, returns, returns_optional, error_type, imports, tested, tests, test_file_path, file_path
| name | kind | lang | domain | version | purity | signature | description | tags | uses_functions | uses_types | returns | returns_optional | error_type | imports | tested | tests | test_file_path | file_path | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| go_build_binary | function | go | infra | 1.0.0 | impure | func GoBuildBinary(projectDir, outputPath string, ldflags string, tags string) error | Compila un binario Go desde un directorio de proyecto. Si ldflags está vacío usa -s -w (strip debug). Si outputPath está vacío usa build/{dirname} dentro del projectDir. Ejecuta con CGO_ENABLED=0. |
|
false | error_go_core |
|
true |
|
functions/infra/go_build_binary_test.go | functions/infra/go_build_binary.go |
Ejemplo
// Compilar con opciones por defecto
err := GoBuildBinary("/home/user/apps/myapp", "", "", "")
// genera /home/user/apps/myapp/build/myapp
// Compilar con output y tags explícitos
err = GoBuildBinary("/home/user/apps/myapp", "/tmp/myapp-bin", "-s -w -X main.version=1.0", "fts5")
if err != nil {
log.Fatal(err)
}
Notas
Usa CGO_ENABLED=0 para binarios estáticos compatibles con imágenes alpine. El flag -trimpath elimina rutas absolutas del binario para reproducibilidad. Los flags -s -w reducen el tamaño eliminando información de debug y la tabla de símbolos. Compatible con el flujo deploy_app que genera Dockerfile multi-stage.