如何設置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.pswp.cn/news/394483.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/394483.shtml
英文地址,請注明出處:http://en.pswp.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;請計…