如何设置Windows版Go —快速简便的指南

by Linda Gregier

琳达·格雷格(Linda Gregier)

Another great language to add to your full-stack developer tool belt is the simple and productive general-purpose programming language of Go.

添加到您的全栈开发人员工具带中的另一种很棒的语言是Go的简单而高效的通用编程语言。

Through a project started in 2007, Go came to fruition through the efforts of some Google programmers. They took great care in Go’s design to make it clear and consistent in its language features and standard libraries, making Go easy and fun to use.

通过2007年启动的一个项目,Go在一些Google程序员的努力下得以实现。 他们在Go的设计中格外小心,以使其语言功能和标准库清晰且一致,从而使Go易于使用且有趣

It’s open-source at it’s best…but don’t forget: it’s case-sensitive!

最好是开源的……但不要忘记:它区分大小写!

So let’s get started on the Microsoft Windows 10 operating system. You’ll see just how easy this really is — only a basic working knowledge of GitHub and the command prompt is required. Sure there are other ways of installing and running the program, but with limited coding background I felt this set of instructions was the easiest to understand and follow.

因此,让我们开始使用Microsoft Windows 10操作系统。 您会看到这真的很容易-只需具备GitHub的基本工作知识和命令提示符即可。 当然,还有其他安装和运行程序的方法,但是在有限的编码背景下,我觉得这组说明最容易理解和遵循。

Be sure to follow these steps in their entirety as well as in the correct order (as listed) to save yourself from having to uninstall Go and spend a few hours troubleshooting any installation-related issues.

请确保完整并按照正确的顺序(如所列)执行这些步骤,以免去卸载Go并花几个小时对所有与安装有关的问题进行故障排除。

阶段1:按以下顺序安装以下组件 (Phase 1: Install the following in this order)

  1. As Go uses open-source (FREE!) repositories often, be sure to install the Git package here first.

    由于Go经常使用开源(FREE!)存储库,因此请确保首先在此处安装Git软件包。

  2. Navigate to the Go installation website here. Download and install the latest 64-bit Go set for Microsoft Windows OS.

    在此处导航到Go安装网站。 下载并安装适用于Microsoft Windows OS的最新64位Go集。

  3. Follow the instructions on the Go installation program.

    按照Go安装程序上的说明进行操作。
  4. Run the Command Prompt on your computer by searching for “cmd”. Open the command line and type: “go version”

    通过搜索“ cmd”在计算机上运行命令提示符。 打开命令行并输入:“ go version”
  5. The output after entering go version should look like this:

    输入go版本后的输出应如下所示:

阶段2:创建Go工作区 (Phase 2: Creating your Go work-space)

First, confirm your Go binaries: go to your computer’s Control Panel, then to System and Security > System > Advanced system settings, and on the left-hand pane click the Advanced tab. Then click on Environmental Variables on the bottom-right-hand side. Ensure Path under System Variables has the “C:\Go\bin” variable in it.

首先,确认您的Go二进制文件:转到计算机的“控制面板”,然后转到“系统和安全性”>“系统”>“高级”系统设置,然后在左侧窗格中单击“高级”选项卡。 然后单击右下角的环境变量。 确保系统变量下的路径中包含“ C:\ Go \ bin”变量。

Then create your Go work-space. This will be in a separate and new folder from where the Go installation files are saved. For example, your G installation files were saved under the path C:\Go and you are creating your Go work-space under C:\Projects\Go

然后创建您的Go工作区。 该文件将保存在一个单独的新文件夹中,其中保存了Go安装文件。 例如,您的G安装文件保存在路径C:\ Go下,并且您正在C:\ Projects \ Go下创建Go工作区。

In your new Go work-space folder, set up three new folders:

在新的Go工作区文件夹中,设置三个新文件夹:

阶段3:创建GOPATH环境变量 (Phase 3: Create the GOPATH environment variable)

Create the GOPATH variable and reference your newly-created Go work-space. Go back to your Control Panel and navigate to System and then Environmental Variables. Then under System Variables click on New.

创建GOPATH变量并引用您新创建的Go工作空间。 返回控制面板并导航至“系统”,然后导航至“环境变量”。 然后在“系统变量”下单击“新建”。

Next to Variable Name, enter “GOPATH,” and next to Variable Value enter “C:\Projects\Go”

在“变量名称”旁边,输入“ GOPATH”,在“变量值”旁边输入“ C:\ Projects \ Go”

To check that your path has been set correctly, enter “echo %GOPATH%” on the command line.

要检查路径设置是否正确,请在命令行上输入“ echo%GOPATH%”。

阶段4:测试并确保 (Phase 4: Test and ensure)

Now you’re ready to verify that all is working correctly by opening the command line and typing: go get github.com/golang/example/hello

现在,您可以通过打开命令行并键入以下命令来验证所有组件是否正常工作: go get github.com/golang/example/hello

Wait for the code to be entirely implemented (this could take a few seconds), then enter in the following in the command line: %GOPATH%/bin/hello

等待代码完全实现(这可能需要几秒钟),然后在命令行中输入以下内容: %GOPATH%/bin/hello

If the installation was successful, you should get the following return message: “Hello, Go examples!”

如果安装成功,您将收到以下返回消息:“ Hello,Go examples!”

I hope you are successful. And if you run into any errors or confusing messages, comment below with the results of this command line: “go env”

希望你成功。 并且,如果您遇到任何错误或令人困惑的消息,请在下面用此命令行的结果进行注释:“ go env”

Inspiration for this article came from the following on-line resources which were very easy to understand and helpful when setting up Go on my Windows operating system:

本文的灵感来自以下在线资源,这些资源在我的Windows操作系统上设置Go时非常容易理解和帮助:

Wade Wegner’s visually-simple & stylistic article

韦德·韦格纳(Wade Wegner)的视觉上简单且风格独特的文章

And now you’re ready to become a “Gopher”!

现在您已准备好成为“地鼠”!

翻译自: https://www.freecodecamp.org/news/setting-up-go-programming-language-on-windows-f02c8c14e2f/

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/394483.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

python计算现场得分_浅谈用 Python 计算文本 BLEU 分数

浅谈用 Python 计算文本 BLEU 分数BLEU, 全称为 Bilingual Evaluation Understudy(双语评估替换), 是一个比较候选文本翻译与其他一个或多个参考翻译的评价分数尽管 BLEU 一开始是为翻译工作而开发, 但它也可以被用于评估文本的质量, 这种文本是为一套自然语言处理任务而生成的…

Unity的几个特殊文件夹

1.以.开头的文件夹会被unity忽略,资源不会被导入,脚本不会编译。 2.Standard Assets和Pro Standard Assets:在这个文件夹中的脚本最先被编译。 3.Editor:以Editor命名的文件夹允许其中的脚本访问Unity Editor的API。如果脚本中使用…

怎么上传文件到kk服务器,VS Code 关于SFTP上传文件到多服务器的配置

工欲善其事,必先利其器!刚学前端的时候一直用的DW来编写代码,其功能非常强大,但在Linux下不能用,所以就转VS Code了。但是刚开始使用VS Code的时候,很多DW上的功能需要自己安装扩展,并配置才可以…

CentOS7 Firewall NAT 及端口映射

本节介绍用CentOS7的Firewalll来做NAT以及端口映射实验拓扑:因为我的环境里CentOS7上有KVM虚拟机需要共享网卡上网,所以我把网卡都添加到了桥里面,当然这里也可以不用桥,直接用物理网口;用nmcli创建桥,并添加网口到桥&…

JVM源码---教你傻瓜式编译openjdk7(JAVA虚拟机爱好者必看)

LZ经过一个星期断断续续的研究,终于成功的搞定了JDK的成功编译与调试。尽管网络上的教程也有不少,包括源码中也有自带的编译步骤说明,但真正自己动手的话,还是会遇到不少意料之外的错误。 为了方便各位猿友编译,LZ临时…

leetcode1105. 填充书架(动态规划)

附近的家居城促销,你买回了一直心仪的可调节书架,打算把自己的书都整理到新的书架上。 你把要摆放的书 books 都整理好,叠成一摞:从上往下,第 i 本书的厚度为 books[i][0],高度为 books[i][1]。 按顺序 将…

python 微信bot_使用Tweepy在Python中创建Twitter Bot

python 微信botby Lucas Kohorst卢卡斯科斯特(Lucas Kohorst) 使用Tweepy在Python中创建Twitter Bot (Create a Twitter Bot in Python Using Tweepy) With about 15% of Twitter being composed of bots, I wanted to try my hand at it. I googled how to create a Twitter …

第五周学习进度

1.学习所花时间:单纯Java是12个小时左右; 2.代码量:大约300行; 3.博客量:1篇。 4.了解到的知识点:数据库语言的增删改查 5.下周计划除了掌握课上知识外,还要再复习之前的关于Java的相关知识点。…

另一个域的cookie_一定要知道的第一方Cookie和第三方Cookie

Cookie 是您访问过的网站创建的文件,用于存储浏览信息,例如您的网站偏好设置或个人资料信息。共有两种类型的 Cookie:第一方 Cookie 是由地址栏中列出的网站域设置的 Cookie,而第三方 Cookie 来自在网页上嵌入广告或图片等项的其他…

苹果手机怎么连接不了无线网络连接服务器,苹果手机连接wifi显示无互联网连接怎么办?...

在开始对网络操作以后,也可尝试着把 iPhone 重新启动一下,按下 iPhone 电源键不放,直到出现关机选项并滑动关机,最后再开机。在 iPhone 的无线局域网列表中,当前连接的这个无线网络显示“无互联网连接”。此时可以通过…

中小企业大数据应用之道:思维在于借力

要想大数据落地,特别是中小企业,首先得有大数据思维,否则大数据的案例不能直接借鉴,自己摸索又怕不专业、坑太多。 何谓大数据思维,个人认为不是什么决策都参考数据,也不是什么问题都要足够精准&#xff0c…

git学习心得之从远程仓库克隆

现在,远程库已经准备好了,下一步是用命令git clone克隆一个本地库: $ git clone gitgithub.com:michaelliao/gitskills.git Cloning into gitskills... remote: Counting objects: 3, done. remote: Total 3 (delta 0), reused 0 (delta 0) R…

leetcode350. 两个数组的交集 II(hashmap)

给定两个数组&#xff0c;编写一个函数来计算它们的交集。 将长度小的数组放入hashmap&#xff0c;记录出现的次数&#xff0c;遍历另一个数组&#xff0c;找出交集 class Solution {public int[] intersect(int[] nums1, int[] nums2) {ArrayList<Integer> resnew Arra…

如何使用Swift Playgrounds制作东西

by Harshita Arora通过Harshita Arora 如何使用Swift Playgrounds制作东西 (How to make something with Swift Playgrounds) Just a few days ago, I finished my WWDC 2018 scholarship submission. It was so much fun creating Alice in codeLand. This was my first year…

2018-2019 20165208 网络对抗 Exp3 免杀原理与实践

目录 2018-2019 20165208 网络对抗 Exp3 免杀原理与实践实验内容基础问题回答实践过程记录任务一&#xff1a;正确使用免杀工具或技巧任务二&#xff1a;通过组合应用各种技术实现恶意代码免杀任务三&#xff1a;用另一电脑实测&#xff0c;在杀软开启的情况下&#xff0c;可运…

k均值例子 数据挖掘_人工智能、数据挖掘、机器学习和深度学习的关系

一、人工智能人工智能是计算机科学的一个分支&#xff0c;它企图了解智能的实质&#xff0c;并生产出一种新的能以人类智能相似的方式做出反应的智能机器。实际应用比如&#xff1a;机器视觉&#xff0c;指纹识别&#xff0c;人脸识别&#xff0c;视网膜识别&#xff0c;虹膜识…

hive中sql使用英文分号

hql只要遇见分号则认识是语句的EOF&#xff0c;所以对于分号&#xff0c;需要用“\“转义。 例如&#xff1a; insert overwrite table test_json_map select {"accountid":"1_:\;11"}, t.map_col from t where dt 2017-08-08 limit 1; 或者用”\073&qu…

软件系统换服务器地址,天正软件客户端修改服务器地址

天正软件客户端修改服务器地址 内容精选换一换如果IP经过NAT/WAF&#xff0c;则只能获取到NAT/WAF转化后的IP地址&#xff0c;无法获取到NAT/WAF前的IP地址。如果客户端为容器&#xff0c;只能获取到容器所在主机的IP地址&#xff0c;无法获取容器的IP。四层监听器(TCP/UDP)开启…

orcale可视化建立用户_建立动态可视化的新方法

orcale可视化建立用户by Sushrut Shivaswamy通过Sushrut Shivaswamy 建立动态可视化的新方法 (A new way of building dynamic visualisations) The Flux architecture gained popularity after Facebook adopted it. It’s a way of managing the state of React components …

leetcode剑指 Offer 47. 礼物的最大价值(动态规划)

在一个 m*n 的棋盘的每一格都放有一个礼物&#xff0c;每个礼物都有一定的价值&#xff08;价值大于 0&#xff09;。你可以从棋盘的左上角开始拿格子里的礼物&#xff0c;并每次向右或者向下移动一格、直到到达棋盘的右下角。给定一个棋盘及其上面的礼物的价值&#xff0c;请计…