Skip to content

joxon/hello-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

简介 / Overview

Offical docs

The Go programming language is an open source project to make programmers more productive.

Go is expressive, concise, clean, and efficient. Its concurrency mechanisms make it easy to write programs that get the most out of multicore and networked machines, while its novel type system enables flexible and modular program construction. Go compiles quickly to machine code yet has the convenience of garbage collection and the power of run-time reflection. It's a fast, statically typed, compiled language that feels like a dynamically typed, interpreted language.

亮点 / Highlights

  • 并行性支持
  • 垃圾回收
  • 运行时反射
  • 静态类型
  • 编译型语言

配置 / Configurations

安装 Go 语言插件 / Installing the Go Extension

成功安装 Go 插件后,安装第三方工具成功的日志:

Installing 9 tools at C:\Users\User\go\bin
gocode
go-outline
go-symbols
guru
gorename
gocode-gomod
godef-gomod
goreturns
golint

Installing github.com/mdempsky/gocode SUCCEEDED
Installing github.com/ramya-rao-a/go-outline SUCCEEDED
Installing github.com/acroca/go-symbols SUCCEEDED
Installing golang.org/x/tools/cmd/guru SUCCEEDED
Installing golang.org/x/tools/cmd/gorename SUCCEEDED
Installing github.com/stamblerre/gocode SUCCEEDED
Installing github.com/ianthehat/godef SUCCEEDED
Installing github.com/sqs/goreturns SUCCEEDED
Installing golang.org/x/lint/golint SUCCEEDED

All tools successfully installed. You're ready to Go :).

若遇到FAILED提示,一般是因为墙的干扰。此处可将 VSCode 中Settings -> Http: Proxy设置为http://127.0.0.1:1080,利用本地代理服务(前提是开启了相关服务)完成安装。

环境变量 / Env

  • GOPATH:Go 项目的工作目录,默认为 C:\Users\Username\go。一般在系统变量中属于用户变量,可以根据自己的喜好放置在自定义的路径,但是一般只有一个。在 VSCode 里面可以设置"go.inferGopath": true来自动推断工作路径,但是一旦切换到别的工作路径,编译好的第三方工具需要重新下载源码并编译,也可从旧目录中复制过去。子目录一般有三个,分别是
    • src / 源代码,其下子目录为包名
    • bin / 生成的可执行文件,二进制格式
    • pkg / 生成的包文件,一般后缀为.a
  • GOROOT:Go 语言的工具集目录,默认是 C:\Go。

运行单个 Go 文件 / Running a single Go file

go run hello.go 或 安装Code Runner后右键点击Run Code

教程 / Tours

Overview

  • Go programmers typically keep all their Go code in a single workspace.
  • A workspace contains many version control repositories (managed by Git, for example).
  • Each repository contains one or more packages.
  • Each package consists of one or more Go source files in a single directory.
  • The path to a package's directory determines its import path.

Note that this differs from other programming environments in which every project has a separate workspace and workspaces are closely tied to version control repositories.

About

Learning Go

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages