0
点赞
收藏
分享

微信扫一扫

我的GO+语言初体验-Go+入门安装避坑手册

一、入门简介

英文介绍

  • For engineering: working in the simplest language that can be mastered by children.
  • For STEM education: studying an engineering language that can be used to work in the future.
  • For data science: communicating with engineers in the same language.

重点翻译:

  • 工程上用: 简单好用
  • STEM教育:简单好用
  • 科学数据:简单好用

我的GO+语言初体验-Go+入门安装避坑手册_intellij-idea

二、官方文档

代码库: 

​​GitHub - goplus/gop: GoPlus - The Go+ language for engineering, STEM education, and data science​​

官方网站:

  • ​​Go+ by Tutorials​​

中文社区:


GO+入门


三、安装步骤

1、下载源码:

 git clone https://github.com/goplus/gop.git

我的GO+语言初体验-Go+入门安装避坑手册_intellij-idea_02

2、安装gop

 我的GO+语言初体验-Go+入门安装避坑手册_github_03

 这就有点尴尬了

我的GO+语言初体验-Go+入门安装避坑手册_java_04

 我的GO+语言初体验-Go+入门安装避坑手册_intellij idea_05

 是个啥

程序员的标准动作

我的GO+语言初体验-Go+入门安装避坑手册_github_06

摆个度

​​Go下载 - Go语言中文网 - Golang中文社区 (studygolang.com)​​

先去下载go

我的GO+语言初体验-Go+入门安装避坑手册_java_07

我的GO+语言初体验-Go+入门安装避坑手册_intellij idea_08

 我的GO+语言初体验-Go+入门安装避坑手册_intellij idea_09

 我的GO+语言初体验-Go+入门安装避坑手册_github_10

 我的GO+语言初体验-Go+入门安装避坑手册_github_11

 我的GO+语言初体验-Go+入门安装避坑手册_intellij-idea_12

 我的GO+语言初体验-Go+入门安装避坑手册_java_13

胜利就在眼前

我的GO+语言初体验-Go+入门安装避坑手册_java_14

 高兴太早

go: github.com/goplus/gox@v1.8.0: Get "https://proxy.golang.org/github.com/goplus/gox/@v/v1.8.0.mod": dial tcp 172.217.27.145:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
go: github.com/goplus/gox@v1.8.0: Get "https://proxy.golang.org/github.com/goplus/gox/@v/v1.8.0.mod": dial tcp 172.217.27.145:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

意思就是你下不了需要换一下

设置goproxy

PS D:\git\2021\goplus\gop>  $env:GO111MODULE = "on"
PS D:\git\2021\goplus\gop> $env:GOPROXY = "https://goproxy.cn"

我的GO+语言初体验-Go+入门安装避坑手册_github_15

安装gop

 D:\git\2021\goplus\gop>go run cmd/install.go --install --autoproxy
Installing Go+ tools...
go: downloading github.com/goplus/gox v1.8.0
go: downloading github.com/qiniu/x v1.11.5
go: downloading golang.org/x/mod v0.5.1
go: downloading golang.org/x/tools v0.1.7
go: downloading golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
go: downloading golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e
go build: cannot write multiple packages to non-directory D:\git\2021\goplus\gop\bin

意思很明显了

我的GO+语言初体验-Go+入门安装避坑手册_github_16

那就new一个

 执行一下 ./all.bat

我的GO+语言初体验-Go+入门安装避坑手册_java_17

安装成功

D:\git\2021\goplus\gop>go run cmd/install.go --install --autoproxy
Installing Go+ tools...
golang.org/x/xerrors/internal
golang.org/x/mod/semver
github.com/goplus/gop/x/mod/internal/lazyregexp
github.com/goplus/gop/token
github.com/goplus/gop/scanner
github.com/qiniu/x/log
golang.org/x/mod/internal/lazyregexp
github.com/goplus/gop/env
golang.org/x/xerrors
github.com/goplus/gox/internal/go/printer
github.com/goplus/gop/ast
github.com/goplus/gox/internal
golang.org/x/sys/execabs
golang.org/x/mod/module
github.com/goplus/gox/internal/go/format
github.com/goplus/gop/parser
golang.org/x/tools/internal/typeparams
github.com/goplus/gop/x/mod/modfile
golang.org/x/mod/modfile
golang.org/x/tools/internal/event/label
golang.org/x/tools/internal/event/keys
golang.org/x/tools/go/internal/gcimporter
golang.org/x/tools/internal/typesinternal
golang.org/x/tools/go/ast/astutil
github.com/goplus/gop/cmd/internal/modfetch
golang.org/x/tools/internal/event/core
golang.org/x/tools/go/types/typeutil
golang.org/x/tools/go/gcexportdata
github.com/goplus/gop/cmd/internal/search
github.com/goplus/gop/printer
golang.org/x/tools/internal/event
github.com/goplus/gop/cmd/goptestgo
golang.org/x/tools/internal/gocommand
github.com/goplus/gop/format
github.com/goplus/gop/cmd/gopfmt
golang.org/x/tools/go/internal/packagesdriver
golang.org/x/tools/internal/packagesinternal
golang.org/x/tools/go/packages
github.com/goplus/gox
github.com/goplus/gop/cl
github.com/goplus/gop/cmd/gengo
github.com/goplus/gop/x/gopmod
github.com/goplus/gop/cmd/internal/modload
github.com/goplus/gop/cmd/internal/base
github.com/goplus/gop/cmd/goprun
github.com/goplus/gop/cmd/internal/build
github.com/goplus/gop/cmd/internal/clean
github.com/goplus/gop/cmd/internal/env
github.com/goplus/gop/cmd/internal/gengo
github.com/goplus/gop/cmd/internal/gopfmt
github.com/goplus/gop/cmd/internal/help
github.com/goplus/gop/cmd/internal/install
github.com/goplus/gop/cmd/internal/mod
github.com/goplus/gop/cmd/internal/run
github.com/goplus/gop/cmd/internal/test
github.com/goplus/gop/cmd/internal/version
github.com/goplus/gop/cmd/gop


Go+ tools installed successfully!
Next:
We just installed Go+ into the directory: D:\git\2021\goplus\gop\bin

To setup a better Go+ development environment,
we recommend you add the above install directory into your PATH environment variable.

验证环境

按直觉都行不通 

我的GO+语言初体验-Go+入门安装避坑手册_golang_18

查看gop的bin目录

我的GO+语言初体验-Go+入门安装避坑手册_intellij-idea_19

 我的GO+语言初体验-Go+入门安装避坑手册_golang_20

 我的GO+语言初体验-Go+入门安装避坑手册_intellij-idea_21

PS D:\git\2021\goplus\gop\bin> .\gop.exe
Gop is a tool for managing Go+ source code.

Usage:

gop [arguments]

The commands are:

run Run a Go+ program
go Convert Go+ packages into Go packages
fmt Format Go+ packages
mod module maintenance
install Build Go+ files and install target to GOBIN
build Build Go+ files
clean Clean all Go+ auto generated files
env prints Go+ environment information.
test Test Go+ packages
version Version prints the build information for Gop executables

Use "gop help " for more information about a command.

验证成功

四、DEMO实战

官方例子

​​Go+ by Tutorials: Hello world (goplus.org)​​

​​The Go+ Playground (goplus.org)​​

1、允许结果

我的GO+语言初体验-Go+入门安装避坑手册_intellij idea_22

2、在demo创建helleword.go空白文件

3、写入代码

package main


import "fmt"


func main() {
fmt.Println([]float64{1, 2, 3.4})
}

4、运行命令

 .\gop.exe run ..\demo\helloworld.go

使用感想

1、官网有必要说明一下与go的关系;一开始个人以为和go没什么太大关系,但是实际安装的时候是需要安装go才能安装go+,容易给使用者产生误导;源码中是有依赖的

我的GO+语言初体验-Go+入门安装避坑手册_intellij idea_23

2、go+有很多特性,如1)有理数:bigint、bigrat、bigfloat,2.地图文字;3. 切片字面量等,可以增加一些demo来引用这些特性,场景化的引导用户使用



举报

相关推荐

0 条评论