Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to configure golang with sublime text3 as IDE

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

Editor to share with you how golang uses sublime text3 as an IDE configuration, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

1. Install sublime text3

two。 Install the go language package

3. Test whether the go language is installed successfully

Type the cmd command, open the dos window, and type the go command (if you can't find it in the default path, you can find it in the installation directory, eg:go/bin)

4. Configure environment variables

My computer = "attribute =" system setting = "Environment variable setting, add GOPATH variable, the path of this variable is where the source code is placed."

There are also two variables, which are generally set by default, GO and GOROOT

Environment variable configuration:

Goroot: the path to install the go package, go/bin

Gopath: the source code path to compile

Path:go

Note: there is no semicolon after gopath. Some win7 and win10 will report an error with a semicolon. Other versions have not found it yet.

5. Check whether the environment variable setting is successful or not. Type go env in dos to view

6. Configure sublime text3 (install the sublime plug-in)

1)。 First install the package Control package, shortcut key ctrl+ `(menu item View > Show Console to bring up the command interface), and type x

Import urllib.request,os;pf='Package Control.sublime-package';ipp=sublime.installed_packages_path (); urllib.request.install_opener (urllib.request.build_opener (urllib.request.ProxyHandler (); open (os.path.join (ipp,pf), 'wb') .write (urllib.request.urlopen (' http://sublime.wbond.net/'+pf.replace('','% 20')) .read (); restart sublime text3

Https://packagecontrol.io/installation#st3

2) .preferences = > package control (or shortcut key ctrl+shift+p) enter package install and enter to install the sublime plug-in

3)。 Install the GoSublime plug-in and enter GoSublime in the previous cloth pop-up box

4)。 Install the Go Build plug-in, as above

7. Test the go locale configuration

Execute a piece of go code, put the file in the src folder of gopath, and ctrl+b pop up the execution command box (if it does not appear, set it manually

Tools= > build System= > gosumlime, this sample is fine)

Go run runs the current program and enters information

Go build compiles the current program and outputs the .exe program

Note: there are two ways to see the execution of compilation: 1. In sublime text 3, ctr+b input go run * .go file or go build * .go file to generate * .exe file; 2. Or open a dos window and run the * .go file

Note: if you cannot install package control, you can download package control manually to install it.

Click Preferences > Browse Packages menu

. Enter the upper directory of the open directory, and then enter the Installed Packages/ directory

Download Package Control.sublime-package and copy it to the Installed Packages/ directory

Restart Sublime Text.

If you see the generated files such as 0_package_control, the installation is successful.

These are all the contents of the article "how to configure golang with sublime text3 as IDE". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report