当前位置:网站首页>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
边栏推荐
- 【docsify基本使用】
- 第一行代码(第三版)学习笔记
- Porting RT thread to s5p4418 (V): thread communication
- 【Mask-RCNN】基于Mask-RCNN的目标检测和识别
- The solution of memcpy memory overlap
- Imxq Freescale yocto project compilation record
- Record one time of Tencent Test Development Engineer's automation interface test practice experience
- Daemon and user threads
- 六,购物⻋与订单
- If I am in Zhuhai, where can I open an account? In addition, is it safe to open a mobile account?
猜你喜欢

Go installation and configuration (1)

Four tips in numpy
![[Hot100]回文子串 与 最长回文子串](/img/a5/10dec640f02023c4d55cb42e6309fb.png)
[Hot100]回文子串 与 最长回文子串

Mysql5.7 compressed version installation tutorial

Steps for formulating class or file templates in idea

【docsify基本使用】

汇编语言学习一(有栈协程铺垫,32位寄存器和相关指令学习,未完待续06/29)

How does the CPU recognize the code?

【每日一题】535. TinyURL 的加密与解密

Definition and use of ROS topic messages
随机推荐
0 basic job transfer software test, how to achieve a monthly salary of 9.5k+
【已实现】服务器jar包启动脚本、shell脚本
[Hot100]10. 正则表达式匹配
QT signal slot alarm QObject:: connect:cannot connect (null)
手机开户一般哪个证券公司好?还有,在线开户安全么?
How to set the hot deployment of idea web project
First line of code (Third Edition) learning notes
Go常用命令
Servlet principle
【Hot100】11. 盛最多水的容器
【已解决】ERROR 1290 (HY000): Unknown error 1290
Skillfully use 5 keys to improve office efficiency
Develop common dependency Libraries
六,购物⻋与订单
Four tips in numpy
Goland常用快捷键设置
Google Earth engine (GEE) - Murray global tidal wetland change V1 (1999-2019) data set
[JSON tutorial] Chapter 1 learning notes
ROS program compilation, like no compilation, refers to the execution of the old compiled executable program
It turns out that you are such an array. You have finally learned