|
1 |
| -# 1.1 Installation |
| 1 | +# 1.1 Instalação |
2 | 2 |
|
3 |
| -## Three ways to install Go |
| 3 | +## Os 3 modos de instalar Go |
4 | 4 |
|
5 |
| -There are many ways to configure the Go development environment on your computer, and you can choose whichever one you like. The three most common ways are as follows. |
| 5 | +Existem muitas maneiras de configurar o ambiente de desenvolvimento em seu computador, você pode escolher o modo que preferir. Seguem abaixo os três modos mais comuns de instalar a linguagem: |
6 | 6 |
|
7 | 7 |
|
8 |
| -- Official installation packages. |
9 |
| - - The Go team provides convenient installation packages in Windows, Linux, Mac and other operating systems. This is probably the easiest way to get started. |
10 |
| -- Install it yourself from source code. |
11 |
| - - Popular with developers who are familiar with Unix-like systems. |
12 |
| -- Using third-party tools. |
13 |
| - - There are many third-party tools and package managers for installing Go, like apt-get in Ubuntu and homebrew for Mac. |
14 |
| - |
15 |
| -In case you want to install more than one version of Go on a computer, you should take a look at a tool called [GVM](https://github.com/moovweb/gvm). It is the best tool I've seen so far for accomplishing this task, otherwise you'd have to deal with it yourself. |
| 8 | +- Pacotes de instalação oficiais. |
| 9 | + - O time por trás do Go, proporciona um modo muito conveniente de instalação para Windows, Linux, Mac e outros sistemas operacionais. Esse é o método mais simples para iniciar. |
| 10 | + |
| 11 | +- Instalação através do código fonte. |
| 12 | + - Bem popular entre desenvolvedores familiares com sistemas UNIX-like |
| 13 | + |
| 14 | +- Por terceiros(Pacotes não oficiais). |
| 15 | + - Existem muitos pacotes de terceiros, costumam vir em gerenciadores de pacotes como apt-get no Ubuntu ou homebrew no Mac. |
16 | 16 |
|
17 |
| -## Install from source code |
| 17 | +Caso você queira ter mais de uma versão de Go no seu computador, existe a opção de instalar através do Go Version Manager(GVM). É a melhor ferramenta que tenho visto por cumprir bem as tarefas, entretanto você deverá escolher o modo que ira ser melhor. [GVM](https://github.com/moovweb/gvm) |
18 | 18 |
|
19 |
| -Because some parts of Go are written in Plan 9 C and AT&T assembler, you have to install a C compiler before taking the next step. |
| 19 | +## Instalando pelo Código Fonte |
20 | 20 |
|
21 |
| -On a Mac, if you have installed Xcode, you already have the compiler. |
| 21 | +Algumas partes de Go foram escritas em Plan 9 C e AT&T assembler, você precisará instalar um compilador de C antes de realizar os passos a seguir. |
22 | 22 |
|
23 |
| -On Unix-like systems, you need to install gcc or a similar compiler. For example, using the package manager apt-get (included with Ubuntu), one can install the required compilers as follows: |
| 23 | +No MAC, você precisará do Xcode, que já vem com o compilador incluso. |
| 24 | + |
| 25 | +Em sistemas UNIX-Linux, você deverá instalar o GCC ou algum compilador semelhante. Por exemplo: via apt-get(Ubuntu/Debian) podemos instalar com a seguinte linha no terminal: |
24 | 26 |
|
25 | 27 | `sudo apt-get install gcc libc6-dev`
|
26 | 28 |
|
27 |
| -On Windows, you need to install MinGW in order to install gcc. Don't forget to configure your environment variables after the installation has completed.( ***Everything that looks like this means it's commented by a translator: If you are using 64-bit Windows, you should install the 64-bit version of MinGW*** ) |
| 29 | +Caso seja Fedora, OpenSuse ou outras distribuições, consulte a documentação oficial. |
| 30 | + |
| 31 | +Para o Windows, será necessário ter o MinGW(Consulte a arquitetura do seu Windows antes de instalar) para instalar o GCC. Não se esqueça de configurar as variaveis do sistemas após a instalação ser concluída. |
28 | 32 |
|
29 |
| -At this point, execute the following commands to clone the Go source code and compile it.( ***It will clone the source code to your current directory. Switch your work path before you continue. This may take some time.*** ) |
| 33 | +Para finalmente realizar a instalação através do código fonte, necessitamos realizar o Download e configuração do Git, copiar o repositório e instalar. |
30 | 34 |
|
31 | 35 | git clone https://go.googlesource.com/go
|
32 | 36 | cd go/src
|
33 | 37 | ./all.bash
|
34 | 38 |
|
35 |
| -A successful installation will end with the message "ALL TESTS PASSED." |
36 | 39 |
|
37 |
| -On Windows, you can achieve the same by running `all.bat`. |
| 40 | +Uma instalação de sucesso retornará a mensagem: "ALL TESTS PASSED." (Todos os testes passaram) |
38 | 41 |
|
39 |
| -If you are using Windows, the installation package will set your environment variables automatically. In Unix-like systems, you need to set these variables manually as follows. ( ***If your Go version is greater than 1.0, you don't have to set $GOBIN, and it will automatically be related to your $GOROOT/bin, which we will talk about in the next section***) |
| 42 | +No Windows você pode executar o arquivo `all.bat`. |
| 43 | + |
| 44 | + |
| 45 | +Caso esteja utilizando Windows, a instalação do pacote ira configurar automaticamente todas as variaveis do sistema. Em sistema UNIX-Linux, você precisa configura-las manualmente no final do arquivo `.bash_profile` |
40 | 46 |
|
41 | 47 | export GOROOT=$HOME/go
|
42 | 48 | export GOBIN=$GOROOT/bin
|
43 | 49 | export PATH=$PATH:$GOROOT/bin
|
44 | 50 |
|
45 |
| -If you see the following information on your screen, you're all set. |
46 |
| - |
| 51 | +Se você ver a mensagem a seguir, quer dizer que está tudo pronto! |
47 | 52 | 
|
48 | 53 |
|
49 |
| -Figure 1.1 Information after installing from source code |
| 54 | +Figura 1.1 Informação após instalação via código fonte |
50 | 55 |
|
51 |
| -Once you see the usage information of Go, it means you have successfully installed Go on your computer. If it says "no such command", check that your $PATH environment variable contains the installation path of Go. |
| 56 | +Caso a instalação tenha sido realizada com sucesso e a mensagem "no such command"(Comando inexistente) permaneça. Verifique se as variaveis do sistema foram configuradas corretamente. |
52 | 57 |
|
53 |
| -## Using the standard installation packages |
| 58 | +## Pacotes de instalação padrão |
54 | 59 |
|
55 |
| -Go has one-click installation packages for every supported operating system. These packages will install Go in `/usr/local/go` (`c:\Go` in Windows) by default. Of course this can be modified, but you also need to change all the environment variables manually as I've shown above. |
| 60 | +Go tem uma instalação simples para todos os sistemas operacionais. Esses pacotes são instalados em: `/usr/local/go` (UNIX-like) e `c:\Go` (Windows) por padrão. Claro que podem ser modificados, mas caso a instalação seja em outro local teremos que reconfigurar as variaveis do sistema, como citado acima. |
56 | 61 |
|
57 |
| -### How to check if your operating system is 32-bit or 64-bit? |
| 62 | +### Como checar se meu sistema operacional é 32-bit ou 64-bit? |
58 | 63 |
|
59 |
| -Our next step depends on your operating system type, so we have to check it before we download the standard installation packages. |
| 64 | +O próxima passo depende do tipo de sistema operacional que você está utilizando. Então temos que checar antes de realizar a instalação dos pacotes. |
60 | 65 |
|
61 |
| -If you are using Windows, press `Win+R` and then run the command tool. Type the `systeminfo` command and it will show you some useful system information. Find the line that says "system type" -if you see "x64-based PC" that means your operating system is 64-bit, 32-bit otherwise. |
| 66 | +Se estiver utilizando Windows, pressione `Win+R` e digite: cmd para abrir o prompt de comando. Execute o comando `systeminfo` e procure a linha referente a "system type" -se você ver "x64-based PC", quer dizer que seu sistema é 64-bit. Caso seja "x32-based PC" é 32-bit". |
62 | 67 |
|
63 |
| -I strongly recommend downloading the 64-bit package if you are a Mac user, as Go no longer supports pure 32-bit processors on Mac OSX. |
| 68 | +É recomendavel utilizar versões 64-bit. Se estiver no MAC, Go não suporta mais versão 32-bit do OSX. |
64 | 69 |
|
65 |
| -Linux users can type `uname -a` in the terminal to see system information. |
66 |
| -A 64-bit operating system will show the following: |
| 70 | +No Linux abra um terminal e digite: `uname -a` |
| 71 | +Um sistema 64-bit exibirá a mensagem a seguir: |
67 | 72 |
|
68 |
| - <some description> x86_64 x86_64 x86_64 GNU/Linux |
69 |
| - // some machines such as Ubuntu 10.04 will show as following |
| 73 | + <alguma descrição> x86_64 x86_64 x86_64 GNU/Linux |
| 74 | + // Algumas distribuições exibirão a mensagem a seguir |
70 | 75 | x86_64 GNU/Linux
|
71 | 76 |
|
72 |
| -32-bit operating systems instead show: |
| 77 | +Sistemas 32-bit irão mostrar: |
73 | 78 |
|
74 |
| - <some description> i686 i686 i386 GNU/Linux |
| 79 | + <alguma descrição> i686 i686 i386 GNU/Linux |
75 | 80 |
|
76 | 81 | ### Mac
|
77 | 82 |
|
78 |
| -Go to the [download page](https://golang.org/dl/), choose `go1.4.2.darwin-386.pkg` for 32-bit systems and `go1.4.2.darwin-amd64.pkg` for 64-bit systems. Going all the way to the end by clicking "next", `~/go/bin` will be added to your system's $PATH after you finish the installation. Now open the terminal and type `go`. You should see the same output shown in igure 1.1. |
| 83 | +Vá para a [página de download](https://golang.org/dl/), escolha `go1.4.2.darwin-386.pkg` para sistemas 32-bit ou `go1.4.2.darwin-amd64.pkg` para sistemas 64-bit. Execute o instalador, e o próprio sistema se encarregará de criar as variaveis do sistema. Digite `go` no terminal e a saida será a mesma da figura 1.1. |
| 84 | + |
79 | 85 |
|
80 | 86 | ### Linux
|
81 | 87 |
|
82 |
| -Go to the [download page](https://golang.org/dl/), choose `go1.4.2.linux-386.tar.gz` for 32-bit systems and `go1.4.2.linux-amd64.tar.gz` for 64-bit systems. Suppose you want to install Go in the `$GO_INSTALL_DIR` path. Uncompress the `tar.gz` to your chosen path using the command `tar zxvf go1.4.2.linux-amd64.tar.gz -C $GO_INSTALL_DIR`. Then set your $PATH with the following: `export PATH=$PATH:$GO_INSTALL_DIR/go/bin`. Now just open the terminal and type `go`. You should now see the same output displayed in figure 1.1. |
| 88 | +Vá para a [página de download](https://golang.org/dl/), escolha `go1.4.2.linux-386.tar.gz` para sistemas 32-bit ou `go1.4.2.linux-amd64.tar.gz` para sistemas 64-bit. Caso a instalação seja padrão, descompacte o arquivo `.tar.gz` em "/usr/local", configure o arquivo .bash_profile como apresentado anteriormente, abra um terminal digite `go` no terminal e a saida será a mesma da figura 1.1. |
| 89 | + |
83 | 90 |
|
84 | 91 | ### Windows
|
85 | 92 |
|
86 |
| -Go to the [download page](https://golang.org/dl/), choose `go1.4.2.windows-386.msi` for 32-bit systems and `go1.4.2.windows-amd64.msi` for 64-bit systems. Going all the way to the end by clicking "next", `c:/go/bin` will be added to `path`. Now just open a command line window and type `go`. You should now see the same output displayed in figure 1.1. |
| 93 | +Vá para a [página de download](https://golang.org/dl/), escolha `go1.4.2.windows-386.msi` para sistemas 32-bit ou `go1.4.2.windows-amd64.msi` para sistemas 64-bit. Execute o instalador, ele irá instalar na masta `c:\go`, as variaveis do sistema serão configuradas automaticamente. Abra um prompt de comando e digite: `go`, a saida será a mesma da figura 1.1. |
87 | 94 |
|
88 |
| -## Use third-party tools |
| 95 | +## Pacotes de terceiros |
89 | 96 |
|
90 |
| -### GVM |
| 97 | +### GVM (Go Version Manager) |
91 | 98 |
|
92 |
| -GVM is a Go multi-version control tool developed by a third-party, like rvm for ruby. It's quite easy to use. Install gvm by typing the following commands in your terminal: |
| 99 | +GVM é um gerenciador de versões para Go, assim como o RVM para Ruby. É muito simples utilizar esse método. Para instalar o GVM execute o comando abaixo no terminal: |
93 | 100 |
|
94 | 101 | bash < <(curl -s -S -L https://raw.github.com/moovweb/gvm/master/binscripts/gvm-installer)
|
95 | 102 |
|
96 |
| -Then we install Go using the following commands: |
| 103 | +Quando o GVM estiver instalado, instale a versão do Go desejada e configure-a para se tornar a padrão. O GVM se encarrega automaticamente de escolher a melhor arquitetura do sistema operacional para você. |
97 | 104 |
|
98 | 105 | gvm install go1.4.2
|
99 | 106 | gvm use go1.4.2
|
100 | 107 |
|
101 |
| -After the process has finished, you're all set. |
| 108 | +Após finalizar os processos, você já poderá utilizar o Go. |
102 | 109 |
|
103 | 110 | ### apt-get
|
104 | 111 |
|
105 |
| -Ubuntu is the most popular desktop release version of Linux. It uses `apt-get` to manage packages. We can install Go using the following commands. |
| 112 | +Ubuntu é a distribuição Linux mais popular para Desktop doméstico. Ele usa o `apt-get` como gerenciador de pacotes. Podemos instalar utilizando os seguintes comando abaixo no terminal: |
106 | 113 |
|
107 | 114 | sudo add-apt-repository ppa:gophers/go
|
108 | 115 | sudo apt-get update
|
109 | 116 | sudo apt-get install golang-stable
|
110 | 117 |
|
111 | 118 | ### Homebrew
|
112 | 119 |
|
113 |
| -Homebrew is a software management tool commonly used in Mac to manage packages. Just type the following commands to install Go. |
| 120 | +Homebrew é o gerenciador de pacotes para MAC, para instalar o Go rode o comando abaixo no terminal: |
114 | 121 |
|
115 | 122 | brew install go
|
116 | 123 |
|
117 | 124 | ## Links
|
118 | 125 |
|
119 |
| -- [Directory](preface.md) |
120 |
| -- Previous section: [Go environment configuration](01.0.md) |
121 |
| -- Next section: [$GOPATH and workspace](01.2.md) |
| 126 | +- [Sumário](preface.md) |
| 127 | +- Sessão anterior: [Configuração do ambiente de desenvolvimento](01.0.md) |
| 128 | +- Próxima sessão: [$GOPATH e Workspace](01.2.md) |
0 commit comments