go语言windows编程_如何在Windows 10上安装Go并设置本地编程环境

go语言windows编程 介绍 (Introduction)Go is a programming language that was born out of frustration at Google. Developers continually had to pick a language that executed efficiently but took a long time to...
摘要由CSDN通过智能技术生成

go语言windows编程

介绍 (Introduction)

Go is a programming language that was born out of frustration at Google. Developers continually had to pick a language that executed efficiently but took a long time to compile, or to pick a language that was easy to program but ran inefficiently in production. Go was designed to have all three available at the same time: fast compilation, ease of programming, and efficient execution in production.

Go是一种编程语言,它源于Google的无奈之举。 开发人员不断不得​​不选择一种执行效率高但编译时间长的语言,或者选择一种易于编程但在生产中运行效率低下的语言。 Go旨在同时提供所有三个功能:快速编译,易于编程以及在生产中高效执行。

While Go is a versatile programming language that can be used for many different programming projects, it’s particularly well suited for networking/distributed systems programs, and has earned a reputation as “the language of the cloud”. It focuses on helping the modern programmer do more with a strong set of tooling, removing debates over formatting by making the format part of the language specification, as well as making deployment easy by compiling to a single binary. Go is easy to learn, with a very small set of keywords, which makes it a great choice for beginners and experienced developers alike.

尽管Go是一种通用的编程语言,可以用于许多不同的编程项目,但它特别适合于网络/分布式系统程序,并赢得了“云语言”的美誉。 它着重于帮助现代程序员使用强大的工具集来做更多的事情,通过使格式成为语言规范的一部分来消除有关格式的争论,并通过编译为单个二进制文件使部署变得容易。 Go易于学习,只包含很少的关键字,对于初学者和经验丰富的开发人员而言,它都是不错的选择。

This tutorial will guide you through installing Go on your local Windows 10 machine and setting up a programming environment via the command line.

本教程将指导您在本地Windows 10计算机上安装Go并通过命令行设置编程环境。

先决条件 (Prerequisites)

You will need a Windows 10 machine with administrative access that is connected to the internet.

您将需要一台具有管理访问权限的Windows 10计算机,该计算机已连接到Internet。

步骤1 —打开和配置PowerShell (Step 1 — Opening and Configuring PowerShell)

You’ll be completing most of the installation and setup on a command-line interface, which is a non-graphical way to interact with your computer. That is, instead of clicking on buttons, you’ll be typing in text and receiving feedback from your computer through text as well. The command line, also known as a shell, can help you modify and automate many of the tasks you do on a computer every day, and is an essential tool for software developers.

您将在命令行界面上完成大多数安装和设置,这是与计算机交互的非图形方式。 也就是说,您将不用输入按钮,而是输入文本,并通过文本接收来自计算机的反馈。 命令行(也称为外壳程序 )可以帮助您修改和自动化每天在计算机上执行的许多任务,并且是软件开发人员的必备工具。

PowerShell is a program from Microsoft that provides a command-line shell interface. Administrative tasks are performed by running cmdlets, pronounced command-lets, which are specialized classes of the .NET software framework that can carry out operations. Open-sourced in August 2016, PowerShell is now available across platforms, for both Windows and UNIX systems (including Mac and Linux).

PowerShell是Microsoft提供的命令行外壳程序界面程序。 通过运行cmdlet (发音为command-let)来执行管理任务,这些命令.NET软件框架的专用类,可以执行操作。 PowerShell于2016年8月开源,现在可跨平台使用,适用于Windows和UNIX系统(包括Mac和Linux)。

To find Windows PowerShell, you can right-click on the Start menu icon on the lower left-hand corner of your screen. When the menu pops up, click on Search, and then type PowerShell into the search bar. When you are presented with options, right-click on Windows PowerShell from the Desktop app. For the purposes of this tutorial, select Run as Administrator. When you are prompted with a dialog box that asks Do you want to allow this app to make changes to your PC? click on Yes.

要找到Windows PowerShell,可以右键单击屏幕左下角的“ 开始”菜单图标。 弹出菜单时,单击“ 搜索” ,然后在搜索栏中键入PowerShell 。 当您看到选项时,请从“桌面”应用中右键单击Windows PowerShell 。 就本教程而言,选择以管理员身份运行 。 当系统提示您一个对话框,询问您是否要允许此应用程序对PC进行更改时? 单击

Once you do this, you’ll see a text-based interface that has a string of words that looks like this:

完成此操作后,您将看到一个基于文本的界面,该界面包含一串类似于以下内容的单词:

Switch out of the system folder by typing the following command:

通过键入以下命令来退出系统文件夹:

  • cd ~

    光盘〜

You’ll then be in a home directory such as PS C:\Users\sammy.

然后,您将位于主目录中,例如PS C:\Users\ sammy

To continue with the installation process, you must first set up permissions through PowerShell. Configured to run in the most secure mode by default, there are a few levels of permissions that you can set up as an administrator:

要继续安装过程,必须首先通过PowerShell设置权限。 默认情况下,配置为以最安全的模式运行,您可以将以下级别的权限设置为管理员:

  • Restricted is the default execution policy. Under this mode you will not be able to run scripts, and PowerShell will work only as an interactive shell.

    限制是默认执行策略。 在这种模式下,您将无法运行脚本,PowerShell将仅作为交互式外壳运行。

  • AllSigned will enable you to run all scripts and configuration files that are signed by a trusted publisher, meaning that you could potentially open your machine up to the risk of running malicious scripts that happen to be signed by a trusted publisher.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值