From 56a6c9b0fcacb83f54971ef9c2d0521bf1e3be92 Mon Sep 17 00:00:00 2001 From: Manuel Vergara Date: Tue, 15 Nov 2022 23:22:23 +0100 Subject: [PATCH] Translated to Spanish the day10 file Signed-off-by: Manuel Vergara --- es/Days/day10.md | 84 +++++++++++++++++++++++++++++++----------------- 1 file changed, 54 insertions(+), 30 deletions(-) diff --git a/es/Days/day10.md b/es/Days/day10.md index 9fd0030..6082367 100644 --- a/es/Days/day10.md +++ b/es/Days/day10.md @@ -1,34 +1,56 @@ -### The Go Workspace +## The Go Workspace -On [Day 8](day08.md) we briefly covered the Go workspace to get Go up and running to get to the demo of `Hello #90DaysOfDevOps` But we should explain a little more about the Go workspace. +En el [Día 8](day08.md) hablamos brevemente del espacio de trabajo Go para poner en marcha Go y llegar a la demo de `Hello #90DaysOfDevOps`. Hay que explicar un poco más sobre el espacio de trabajo Go. -Remember we chose the defaults and we then went through and created our Go folder in the GOPATH that was already defined but in reality, this GOPATH can be changed to be wherever you want it to be. +¿Recuerda que elegimos los valores predeterminados y luego pasamos a crear nuestra carpeta Go en el GOPATH que ya estaba definido? Pero en realidad, este GOPATH se puede cambiar para que esté donde quieras. -If you run +Si ejecutas ``` echo $GOPATH ``` -The output should be similar to mine (with a different username may be) which is: +La salida debería ser similar a la mía (con tu nombre de usuario): ``` /home/michael/projects/go ``` +> **En Linux tenemos que configurarlo.** +> +> En mi caso que utilizo la shell zsh en el fichero `$HOME/.zshrc`. Si utilizan bash será en el fichero `$HOME/.bashrc`. +> +> Tan solo tenemos que añadir esta línea: +> ```shell +> export GOPATH=$HOME/work +> export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin +> ``` +> +> ![](Images/Day10_Go0.png) +> +> Relanzamos la shell y hacemos el `echo` mencionado antes. +> +> ```shell +> exec zsh +> echo $GOPATH +> ``` +> +> ![](Images/Day10_Go0b.png) +> +> Más información en la [documentación oficial](https://go.dev/doc/install) -Then here, we created 3 directories. **src**, **pkg** and **bin** +Entonces aquí, es donde creamos en anteriores días los 3 directorios. **src**, **pkg** y **bin** -![](Images/Day10_Go1.png) +![](Images/Day10_Go1.png) -**src** is where all of your Go programs and projects are stored. This handles namespacing package management for all your Go repositories. This is where you will see on our workstation we have our Hello folder for the Hello #90DaysOfDevOps project. +- **src** es donde se almacenan todos tus programas y proyectos Go. Esto maneja la gestión de paquetes de namespacing para todos sus repositorios de Go. Aquí es donde verás que en nuestro equipo tenemos nuestra carpeta Hello para el proyecto Hello #90DaysOfDevOps. ![](Images/Day10_Go2.png) -**pkg** is where your archived files of packages that are or were installed in programs. This helps to speed up the compiling process based on if the packages being used have been modified. +- **pkg** es donde se encuentran los ficheros archivados de los paquetes que están o estuvieron instalados en los programas. Esto ayuda a acelerar el proceso de compilación en función de si los paquetes que se utilizan han sido modificados. ![](Images/Day10_Go3.png) -**bin** is where all of your compiled binaries are stored. +- **bin** es donde se almacenan todos los binarios compilados. ![](Images/Day10_Go4.png) @@ -36,47 +58,49 @@ Our Hello #90DaysOfDevOps is not a complex program so here is an example of a mo ![](Images/Day10_Go5.png) -This page also goes into some great detail about why and how the layout is like this it also goes a little deeper on other folders we have not mentioned [GoChronicles](https://gochronicles.com/project-structure/) +Nuestro Hello #90DaysOfDevOps no es un programa complejo. Para que te hagas una idea, un ejemplo de un programa Go más complejo tomado de otro gran recurso que vale la pena mirar es [GoChronicles](https://gochronicles.com/) -### Compiling & running code +## Compiling & running code -On [Day 9](day09.md) we also covered a brief introduction to compiling code, but we can go a little deeper here. +En el [Día 9](day09.md) también hicimos una breve introducción a la compilación de código, pero podemos profundizar un poco más. Vamos a ello. -To run our code we first must **compile** it. There are three ways to do this within Go. +Para ejecutar nuestro código, primero debemos **compilarlo**. Hay tres maneras de hacer esto dentro de Go. -- go build -- go install -- go run +- `go build` +- `go install` +- `go run` -Before we get to the above compile stage we need to take a look at what we get with the Go Installation. +Antes de que lleguemos a la etapa de compilación mencionada, necesitamos echar un vistazo a lo que obtenemos con la instalación de Go. -When we installed Go on Day 8 we installed something known as Go tools which consist of several programs that let us build and process our Go source files. One of the tools is `Go` +Cuando instalamos Go el [día 8](day08.md), instalamos algo conocido como herramientas Go, que consiste en varios programas que nos permiten construir y procesar nuestros ficheros fuente Go. Una de las herramientas es `Go`. -It is worth noting that you can install additional tools that are not in the standard Go installation. +Vale la pena señalar que se pueden instalar herramientas adicionales que no están en la instalación estándar de Go que pueden ser muy útil según el proyecto que quieras desarrollar. -If you open your command prompt and type `go` you should see something like the image below and then you will see "Additional Help Topics" below that for now we don't need to worry about those. +Si abres tu terminal y escribes `go` deberías ver algo como la imagen de abajo y luego verás "Additional Help Topics" (Temas de ayuda adicionales) de los que, por ahora, no necesitamos preocuparnos. ![](Images/Day10_Go6.png) -You might also remember that we have already used at least two of these tools so far on Day 8. +> [Traducción ayuda go](Go/Ayuda_go_traducida.md). + +Si estás aquí desde días anteriores, recordarás que ya hemos utilizado al menos dos de estos comandos en el [Día 8](day08.md). ![](Images/Day10_Go7.png) -The ones we want to learn more about are the build, install and run. +Las que vamos a aprender son las de `build`, `install` y `run`. ![](Images/Day10_Go8.png) -- `go run` - This command compiles and runs the main package comprised of the .go files specified on the command line. The command is compiled to a temporary folder. -- `go build` - To compile packages and dependencies, compile the package in the current directory. If the `main` package, will place the executable in the current directory if not then it will place the executable in the `pkg` folder. `go build` also enables you to build an executable file for any Go Supported OS platform. -- `go install` - The same as go build but will place the executable in the `bin` folder +- `go run` - Este comando compila y ejecuta el paquete principal compuesto por los ficheros .go especificados en la línea de comandos. El comando se compila en una carpeta temporal. +- `go build` - Para compilar los paquetes y las dependencias, compila el paquete en el directorio actual. Así el paquete `main`, colocará el ejecutable en el directorio actual, si no colocará el ejecutable en la carpeta `pkg`. `go build` también permite construir un fichero ejecutable para cualquier sistema operativo compatible con Go. +- `go install` - Lo mismo que `go build` pero colocará el ejecutable en la carpeta `bin`. -We have run through go build and go run but feel free to run through them again here if you wish, `go install` as stated above puts the executable in our bin folder. +Ya hemos visto go build y go run, pero si quieres puedes volver a hacer un `go install`, como ya hemos dicho, coloca el ejecutable en nuestra carpeta bin. ![](Images/Day10_Go9.png) -Hopefully, if you are following along you are watching one of the playlists or videos below, I am taking bits of all of these and translating these into my notes so that I can understand the foundational knowledge of the Golang language. The resources below are likely going to give you a much better understanding of a lot of the areas you need overall but I am trying to document the 7 days or 7 hours worth of the journey with interesting things that I have found. +Si estás siguiendo los recursos con las listas de reproducción o videos que se proponen abajo verás que se están tomando pedazos de estos traducidos en estas notas para poder adquirir un conocimiento básico del lenguaje Golang. Estos recursos probablemente darán una comprensión mucho mejor de una gran cantidad de las áreas que necesita en general, pero se está intentando de documentar los 7 días (o 7 horas) en lo más relevante. -## Resources +## Recursos - [StackOverflow 2021 Developer Survey](https://insights.stackoverflow.com/survey/2021) - [Why we are choosing Golang to learn](https://www.youtube.com/watch?v=7pLqIIAqZD4&t=9s) @@ -86,4 +110,4 @@ Hopefully, if you are following along you are watching one of the playlists or v - [FreeCodeCamp - Learn Go Programming - Golang Tutorial for Beginners](https://www.youtube.com/watch?v=YS4e4q9oBaU&t=1025s) - [Hitesh Choudhary - Complete playlist](https://www.youtube.com/playlist?list=PLRAV69dS1uWSR89FRQGZ6q9BR2b44Tr9N) -See you on [Day 11](day11.md). +Nos vemos en el [Día 11](day11.md).