当前位置:网站首页>Install go language development tools
Install go language development tools
2022-06-30 07:02:00 【Duanxiaoman】
install Go Language development package
stay Windows Installation on Go Language development package
download Go Language development package
stay Go Language website :https://golang.google.cn/dl/ download Windows Under the system Go Language development package , As shown in the figure below :
Here we download 64 Bit development package , If your computer is 32 For the system , You need to download 32 Bit development package .
Be careful : download Windows Version of Go When developing language packages, try to choose MSI Format , Because it can be installed directly into the system , No additional operations are required .
install Go Language development package
Double click to download OK Go Language development kit can start the installer , Follow the prompt steps , There is no longer one by one .
Set the environment variable
After the development package is installed , Before formal programming begins , We need to set some environment variables .
GOPATH: It's a path , It is used to store the code package needed in development . Pictured :
We click Add , Set the corresponding directory . Other environment variables are automatically set in the installation package . When the environment variable is set , Can pass go env Command to check . Pictured :
Only part of the results are shown above , If you execute go env After the command , The results are similar to the above , Explain our Go The development package has been installed successfully .
stay Linux Installation on Go Language development package
We have already introduced in Windows Build on the system Go Language development package , So the same , Let's start with Go Find the corresponding on the official language website os Installation package , As shown in the figure :
But don't worry about downloading , Follow the steps below .
install Go Language development package
- Copy Go Download link of language development kit , such as :https://golang.google.cn/dl/go1.18.3.linux-amd64.tar.gz
- Terminal use
cdCommand to enter the directory where you store the installation package ( such as /usr/local/ Catalog ) - Use
wgetCommand download Go Language development package - Use
tarCommand unzip the just downloaded go Language development package - After successful decompression, a new... Will be added to the current directory go Catalog
thus , We are Linux Installation on system Go The language development kit is complete . And then you can cd To this directory , And then you can use itbin/go versionCommand to view the current Go Language version .
Configure environment variables
We need to configure 2 Environment variables :GOROOT and PATH.
- GOROOT = Go The current installation directory for the language , have access to
export GOROOT=/usr/local/goTo set up . - PATH: For ease of use Go Language command and Go Program executable , Need to add its value , have access to
export PATH=$PATH:$GOROOT/bin:$GOBINTo set up .
For the convenience of future use , You need to add these environment variables to profile In file (~/.bash_profile or /etc/profile). If it's a single user , You can add environment variables to home In the catalog bash_profile In file , If it's multi-user use , Need to be added to /etc/profile file .( I recommend that you /etc/profile Setting environment variables in file ).
Usevi /etc/profileCommand to open profile file , And add the environment variable to the end of the file , And then usesource /etc/profileThe command enables the configuration to take effect . You can use go env Command to view the environment variable parameters .
stay Mac Installation on Go Language development package
Or first Go Find the corresponding on the official language website os Installation package , As shown in the figure :
According to their own OS Download the version .
install Go Language development package
Mac OS Of Go The language development kit is .pkg Format , Double click the installation package we downloaded to start the installation .Mac OS The following is a fool installation , Click all the way “ continue ” that will do , I won't repeat .
The installation package will be installed in by default /usr/local Under the table of contents , As shown below .
After installation , Run at terminal go version, If a message similar to the following appears , Indicating successful installation .
Set up GOPATH environment variable
Start writing go Before project code , We need to configure the environment variables first . edit ~/.bash_profile( Run in terminal vi ~/.bash_profile that will do ) To add the following line of code ( If you can't find .bash_profile, You can create one yourself ):
export GOPATH=$HOME/go
Save and exit your editor . Then run the command in the terminal source ~/.bash_profile Enable environment variables .
$HOME Is the user's home directory under each computer , Each computer may be different , It can run on the terminal echo $HOME obtain .
GOROOT That is to say Go By default, the installation directory of the development package is /usr/local/go, without , Can be in bash_profile Set in file , Use :export GOROOT=/usr/local/go, Then save and exit the editor , function source ~/.bash_profile Command is enough .
install Go Language development IDE
Here are some common Go Language development IDE, They all have automated prompts , automation fmt function . Because they are all cross platform , So the installation steps are all common . Pictured :
Goland
Goland By JetBrains A new business developed by the company IDE, For the purpose of Go Developers provide a new ergonomic business IDE.Goland Integrated IntelliJ platform ( One for the java Integrated environment for language development , It can also be used in other development languages ), For Go Language coding AIDS and tool integration .
Download address : https://www.jetbrains.com/go/
LiteIDE
LiteIDE Is a special for Go Integrated development environment for development , Editing 、 Compile and run Go Very good support for programs and projects . It also includes an abstract syntax tree view of the source code and some built-in tools ( This development environment is developed by Chinese people vfc Uncle developed ).
LiteIDE Is a very easy to use lightweight Go Integrated development environment ( be based on QT、Kate and SciTE), It includes cross platform development and other necessary features , Write code 、 There is excellent support for automatic completion and operation debugging . It USES a Go Project concept to browse and manage project files , It also supports in various Go The function of arbitrary switching between development environments and cross compilation .
meanwhile , It has the function of abstract syntax tree view , You can have a clear overview of constants in your project 、 Variable 、 function 、 Different types and their properties and methods .
Download address http://sourceforge.net/projects/liteide/files
Sublime Text
A revolutionary cross platform (Linux、Mac OS X、Windows) Text editor , It supports writing a lot of programming language code . about Go for , It has a plug-in called GoSublime To support code completion and code templates .
Eclipse
Is a Eclipse IDE Plug in for , Has a lot of features and through GoCode To realize the code completion function . It is attached to the famous Eclipse This large-scale development environment , Although you need to install JVM Running environment , But you can easily enjoy Eclipse It has many functions . This is a very good editor , Perfect code completion 、 Abstract syntax tree view 、 Project management and program debugging functions .
Visual Studio Code( abbreviation VS Code)
vscode It's Microsoft based on Electron and web Technology built open source editor , Is a very powerful editor . Open source address :https://github.com/Microsoft/vscode, Can run in Mac OS X、Windows and Linux Cross platform open source code editor on .
VS Code Use JSON Format configuration file for all functions and features configuration , At the same time, it can also realize the programming language for the editor through the extension program 、 Parameters of the tip 、 compile 、 debugging 、 Document generation and other functions .
install Go After the plug-in, you can Go Language development .
Atom
Atom yes GitHub be based on Electron and web Technology built open source editor , Is a very beautiful and powerful editor, the disadvantage is that the speed is relatively slow . Download address : https://atom.io/, Then install go-plus plug-in unit : stay Atom Medium Preference Can be found in install menu , Input go-plus, Then click Install (install), Will start installing go-plus , go-plus The plug-in will automatically install the corresponding dependent plug-ins , If the corresponding... Is not installed go The class library of will run automatically : go get install .
Vim
Vim It's from vi Developed a text editor , Code completion 、 The functions of compiling and error jump are very rich , Widely used in programmers .
vim-go yes vim The above one is open source go Language is the most widely used plug-in development environment
Plug-in address :github.com/fatih/vim-go
边栏推荐
- leetcode:98. 验证二叉搜索树
- 我开户后把账号忘记了咋办?股票在网上开户安全吗?
- 成品升级程序
- Out of class implementation of member function of class template
- 【已解决】Failed! Error: Unknown error 1130
- Qstring to const char*
- Notes: environment variables
- Vscode returns the previous cursor (previous browse position)
- RT thread Kernel Implementation (IV): multi priority
- Mysql5.7 compressed version installation tutorial
猜你喜欢

Connection Flood攻击原理

Relevant database questions.

Class template case - encapsulation of array classes

Rising posture series: fancy debugging information

Go项目目录结构介绍
![[fuzzy neural network] mobile robot path planning based on Fuzzy Neural Network](/img/39/c9bf235828b6d50e7931876fa4a918.png)
[fuzzy neural network] mobile robot path planning based on Fuzzy Neural Network
![[docsify basic use]](/img/9d/db689f5f13708f3e241474afeca1d0.png)
[docsify basic use]

It turns out that you are such an array. You have finally learned

Egret P2 pit encountered by physical engine (1)

Performance comparison of random network, scale-free network, small world network and NS small world matlab simulation
随机推荐
Ftplib+ tqdm upload and download progress bar
Principle: webmvcconfigurer and webmvcconfigurationsupport pit avoidance Guide
SOC_ AHB_ SD_ IF
Traverse map
Fastapi learning Day1
JS null judgment operators | and? Usage of
RT thread Kernel Implementation (IV): multi priority
Skillfully use 5 keys to improve office efficiency
[Hot100]10. Regular Expression Matching
Authority management system
Records of problems solved (continuously updated)
Redis cache
[Hot100]回文子串 与 最长回文子串
Mysql5.7 compressed version installation tutorial
Use of sscanf function
If I am in Zhuhai, where can I open an account? In addition, is it safe to open a mobile account?
sscanf 函数的使用
Egret engine P2 physics engine (2) - Funny physical phenomenon of small balls hitting the ground
随机网络,无标度网络,小世界网络以及NS小世界的性能对比matlab仿真
Solr search