Translate INSTALLATION section, updated preface
This commit is contained in:
@@ -2,19 +2,19 @@
|
||||
|
||||
Seja bem vindo ao mundo Go, vamos começar a explorar!
|
||||
|
||||
Go é uma linguagem compilada rápida incluindo coletor de lixo e multiplataforma. Veja abaixo algumas vantagens de utiliza-la:
|
||||
Go é uma linguagem compilada rápida incluindo coletor de lixo e multiplataforma. Veja abaixo algumas vantagens de utiliza la:
|
||||
|
||||
- Compilação rápida em projetos de todos os portes.
|
||||
- Mantém um modelo padrão no desenvolvimento de software, sendo assim evitando futuros problemas associados ao estilo C de desenvolvimento.
|
||||
- É estática, não tem niveis no seu sistema de tipo, então não precisaremos gastar tempo trabalhando com a relação de tipos de variaveis. É bem leve e orientada a objetos.
|
||||
- É estática, não tem níveis no seu sistema de tipo, então não precisaremos gastar tempo trabalhando com a relação de tipos de variaveis. É bem leve e orientada a objetos.
|
||||
- Realiza a coleta de lixo. Isso melhora o desempenho e a comunicação com diversos sistemas operacionais;
|
||||
- Foi desenvida para todas as plataformas.
|
||||
- Foi desenvolvida para todas as plataformas.
|
||||
|
||||
Go é uma linguagem compilada. Combina a eficiência de desenvolvimento das linguagens interpretadas e dinâmicas por sua segurança em tipos estáticos. É uma ótima escolha por ser multi-plataforma e moderna. Por um tempo não haviam pacotes e ferramentas de terceiros para resolver problemas comuns e tudo tinha que ser feito e refeito, como reconstruir a roda, por isso nasceu o interesse na linguagem.
|
||||
|
||||
Nesse capitulo, vamos aprender a instalar e configurar nosso próprio ambiente de desenvolviment.
|
||||
Nesse capitulo, vamos aprender a instalar e configurar nosso próprio ambiente de desenvolvimento.
|
||||
|
||||
## Links
|
||||
|
||||
- [Directory](preface.md)
|
||||
- [Sumário](preface.md)
|
||||
- Próxima sessão: [Instalação](01.1.md)
|
||||
|
||||
105
pt-br/01.1.md
105
pt-br/01.1.md
@@ -1,108 +1,115 @@
|
||||
# 1.1 Installation
|
||||
# 1.1 Instalação
|
||||
|
||||
## Three ways to install Go
|
||||
## Os 3 modos de instalar Go
|
||||
|
||||
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.
|
||||
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:
|
||||
|
||||
|
||||
- Official installation packages.
|
||||
- The Go team provides convenient installation packages in Windows, Linux, Mac and other operating systems. This is probably the easiest way to get started.
|
||||
- Install it yourself from source code.
|
||||
- Popular with developers who are familiar with Unix-like systems.
|
||||
- Using third-party tools.
|
||||
- There are many third-party tools and package managers for installing Go, like apt-get in Ubuntu and homebrew for Mac.
|
||||
|
||||
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.
|
||||
- Pacotes de instalação oficiais.
|
||||
- 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.
|
||||
|
||||
## Install from source code
|
||||
- Instalação através do código fonte.
|
||||
- Bem popular entre desenvolvedores familiares com sistemas UNIX-like
|
||||
|
||||
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.
|
||||
- Por terceiros(Pacotes não oficiais).
|
||||
- Existem muitos pacotes de terceiros, costumam vir em gerenciadores de pacotes como apt-get no Ubuntu ou homebrew no Mac.
|
||||
|
||||
On a Mac, if you have installed Xcode, you already have the compiler.
|
||||
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)
|
||||
|
||||
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:
|
||||
## Instalando pelo Código Fonte
|
||||
|
||||
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.
|
||||
|
||||
No MAC, você precisará do Xcode, que já vem com o compilador incluso.
|
||||
|
||||
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:
|
||||
|
||||
`sudo apt-get install gcc libc6-dev`
|
||||
|
||||
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*** )
|
||||
Caso seja Fedora, OpenSuse ou outras distribuições, consulte a documentação oficial.
|
||||
|
||||
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.*** )
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
git clone https://go.googlesource.com/go
|
||||
cd go/src
|
||||
./all.bash
|
||||
|
||||
A successful installation will end with the message "ALL TESTS PASSED."
|
||||
|
||||
On Windows, you can achieve the same by running `all.bat`.
|
||||
Uma instalação de sucesso retornará a mensagem: "ALL TESTS PASSED." (Todos os testes passaram)
|
||||
|
||||
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***)
|
||||
No Windows você pode executar o arquivo `all.bat`.
|
||||
|
||||
|
||||
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`
|
||||
|
||||
export GOROOT=$HOME/go
|
||||
export GOBIN=$GOROOT/bin
|
||||
export PATH=$PATH:$GOROOT/bin
|
||||
|
||||
If you see the following information on your screen, you're all set.
|
||||
|
||||
Se você ver a mensagem a seguir, quer dizer que está tudo pronto!
|
||||

|
||||
|
||||
Figure 1.1 Information after installing from source code
|
||||
Figura 1.1 Informação após instalação via código fonte
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
## Using the standard installation packages
|
||||
## Pacotes de instalação padrão
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
### How to check if your operating system is 32-bit or 64-bit?
|
||||
### Como checar se meu sistema operacional é 32-bit ou 64-bit?
|
||||
|
||||
Our next step depends on your operating system type, so we have to check it before we download the standard installation packages.
|
||||
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.
|
||||
|
||||
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.
|
||||
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".
|
||||
|
||||
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.
|
||||
É recomendavel utilizar versões 64-bit. Se estiver no MAC, Go não suporta mais versão 32-bit do OSX.
|
||||
|
||||
Linux users can type `uname -a` in the terminal to see system information.
|
||||
A 64-bit operating system will show the following:
|
||||
No Linux abra um terminal e digite: `uname -a`
|
||||
Um sistema 64-bit exibirá a mensagem a seguir:
|
||||
|
||||
<some description> x86_64 x86_64 x86_64 GNU/Linux
|
||||
// some machines such as Ubuntu 10.04 will show as following
|
||||
<alguma descrição> x86_64 x86_64 x86_64 GNU/Linux
|
||||
// Algumas distribuições exibirão a mensagem a seguir
|
||||
x86_64 GNU/Linux
|
||||
|
||||
32-bit operating systems instead show:
|
||||
Sistemas 32-bit irão mostrar:
|
||||
|
||||
<some description> i686 i686 i386 GNU/Linux
|
||||
<alguma descrição> i686 i686 i386 GNU/Linux
|
||||
|
||||
### Mac
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
|
||||
### Linux
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
|
||||
### Windows
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
## Use third-party tools
|
||||
## Pacotes de terceiros
|
||||
|
||||
### GVM
|
||||
### GVM (Go Version Manager)
|
||||
|
||||
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:
|
||||
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:
|
||||
|
||||
bash < <(curl -s -S -L https://raw.github.com/moovweb/gvm/master/binscripts/gvm-installer)
|
||||
|
||||
Then we install Go using the following commands:
|
||||
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ê.
|
||||
|
||||
gvm install go1.4.2
|
||||
gvm use go1.4.2
|
||||
|
||||
After the process has finished, you're all set.
|
||||
Após finalizar os processos, você já poderá utilizar o Go.
|
||||
|
||||
### apt-get
|
||||
|
||||
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.
|
||||
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:
|
||||
|
||||
sudo add-apt-repository ppa:gophers/go
|
||||
sudo apt-get update
|
||||
@@ -110,12 +117,12 @@ Ubuntu is the most popular desktop release version of Linux. It uses `apt-get` t
|
||||
|
||||
### Homebrew
|
||||
|
||||
Homebrew is a software management tool commonly used in Mac to manage packages. Just type the following commands to install Go.
|
||||
Homebrew é o gerenciador de pacotes para MAC, para instalar o Go rode o comando abaixo no terminal:
|
||||
|
||||
brew install go
|
||||
|
||||
## Links
|
||||
|
||||
- [Directory](preface.md)
|
||||
- Previous section: [Go environment configuration](01.0.md)
|
||||
- Next section: [$GOPATH and workspace](01.2.md)
|
||||
- [Sumário](preface.md)
|
||||
- Sessão anterior: [Configuração do ambiente de desenvolvimento](01.0.md)
|
||||
- Próxima sessão: [$GOPATH e Workspace](01.2.md)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#1.2 $GOPATH and workspace
|
||||
#1.2 $GOPATH e Workspace
|
||||
|
||||
## $GOPATH
|
||||
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
- 1.[Go environment configuration](01.0.md)
|
||||
- 1.1. [Installation](01.1.md)
|
||||
- 1.2. [$GOPATH and workspace](01.2.md)
|
||||
- 1.3. [Go commands](01.3.md)
|
||||
- 1.4. [Go development tools](01.4.md)
|
||||
- 1.5. [Summary](01.5.md)
|
||||
- 2.[Go basic knowledge](02.0.md)
|
||||
- 2.1. ["Hello, Go"](02.1.md)
|
||||
- 1.[1 Configuração do ambiente de desenvolvimento](01.0.md)
|
||||
- 1.1. [Instalação](01.1.md)
|
||||
- 1.2. [$GOPATH e Workspace](01.2.md)
|
||||
- 1.3. [Comandos em Go](01.3.md)
|
||||
- 1.4. [Ferramentas de desenvolvimento](01.4.md)
|
||||
- 1.5. [Sumário](01.5.md)
|
||||
- 2.[Go, conhecimento básico](02.0.md)
|
||||
- 2.1. ["Olá, Go"](02.1.md)
|
||||
- 2.2. [Go foundation](02.2.md)
|
||||
- 2.3. [Control statements and functions](02.3.md)
|
||||
- 2.4. [struct](02.4.md)
|
||||
- 2.5. [Object-oriented](02.5.md)
|
||||
- 2.5. [Orientação a Objetos](02.5.md)
|
||||
- 2.6. [interface](02.6.md)
|
||||
- 2.7. [Concurrency](02.7.md)
|
||||
- 2.8. [Summary](02.8.md)
|
||||
- 2.8. [Sumário](02.8.md)
|
||||
- 3.[Web foundation](03.0.md)
|
||||
- 3.1. [Web working principles](03.1.md)
|
||||
- 3.2. [Build a simple web server](03.2.md)
|
||||
@@ -93,4 +93,4 @@
|
||||
- 14.5. [Multi-language support](14.5.md)
|
||||
- 14.6. [pprof](14.6.md)
|
||||
- 14.7. [Summary](14.7.md)
|
||||
- Appendix A [References](ref.md)
|
||||
- Appendix A [References](ref.md)
|
||||
|
||||
Reference in New Issue
Block a user