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 the go language development environment

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly introduces "how to configure the go language development environment". In the daily operation, I believe many people have doubts about how to configure the go language development environment. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "how to configure the go language development environment". Next, please follow the editor to study!

1. Sublime text 3 installation

Download address: https://www.sublimetext.com/3 or local download address

I chose the window installation package.

After download, it will be a point-and-click installation (I won't repeat it)

It will appear on the desktop after installation.

Shortcut icon (if not, you can search sublime on the start menu), double-click to open it.

2. Install Package Control (plug-in management of sublime)

Using ctrl+ `, set up the console

Use the installation code of the official website to install Package Control

Official website address: https://packagecontrol.io/installation

Installation code:

Import urllib.request,os,hashlib;h = '6f4c264a24d933ce70df5dedcf1dcaee' +' ebe013ee18cced0ef93d5f746d80ef60';pf = 'Package Control.sublime-package';ipp = sublime.installed_packages_path (); urllib.request.install_opener (urllib.request.build_opener (urllib.request.ProxyHandler (); by = urllib.request.urlopen (' http://packagecontrol.io/' + pf.replace (','% 20'). Read (); dh = hashlib.sha256 (by). Hexdigest () Print ('Error validating download (got% s instead of% s), please try manual install'% (dh, h)) if dh! = h else open (os.path.join (ipp, pf),' wb') .write (by)

Enter to confirm and start the installation.

After running, Package Control will appear under the menu preferences

You can call up Package Control using Ctrl+Shift+p

Enter install and select install Package enter

After running, the window to install the plug-in will be adjusted.

Search for the desired plug-in and select enter to install it automatically.

3. Install gosublime

Online tutorials are automatically installed by entering gosublime directly, but the reality is cruel.

The installer did not find the gosublime, through a google. Found that the current branch of gosublime does not support automatic installation

The information on the official website is as follows: https://packagecontrol.io/packages/GoSublime

At the same time, the official website provides installable methods:

See https://margo.sh/b/migrate/ for instructions on how to switch to the active development branch.

Click on the link and you will find that you are currently using the development branch.

The installation steps are as follows:

Google translation:

According to the installation documentation, you need to manually download the gosublime code to the package directory of sublime. (git needs to be installed)

Enter the package directory of sublime and jump quickly through the menu Preferences= "Browse Package"

Use git bash,cd to the Package directory

Run git clone https://margo.sh/GoSublime and download the code to the package directory

After downloading, sublime automatically detects the plug-in and installs it. If the go language environment is not installed, an error will be reported.

For installation of go environment, please refer to: https://github.com/astaxie/build-web-application-with-golang/blob/master/zh/01.0.md

Displayed after correct installation:

The plug-in has been installed at this point. Next, you need to configure the plug-in.

Use 'ctrl+.+x' (hold down ctrl, and then press in order. X) Open the margo configuration file. (you can enter and save without modification.) after saving, sublime will automatically apply the configuration.

Then use 'ctrl+.' Adjust the gosublime controller, select default Settings, and enter

Will open the configuration file for gosublime and set the

"gscomplete_enabled": false,// Whether or not gsfmt is enabled "fmt_enabled": false

Change to

"gscomplete_enabled": true, / / Whether or not gsfmt is enabled "fmt_enabled": true

Save the file.

Now create a main.go and start coding in the go language.

You will find that there are code hints now.

And when you save the file, the code is automatically formatted (calling go fmt).

Now our editor has been configured and supports code completion, code highlighting, error prompts, code formatting and other functions.

At this point, the study on "how to configure the go language development environment" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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