我的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教育:简单好用
  • 科学数据:简单好用

二、官方文档

代码库: 

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

官方网站:

中文社区:

https://bbs.csdn.net/topics/603424035

GO+入门

Go+ 概述 | 带你用一文全面了解 Go+-CSDN社区

三、安装步骤

1、下载源码:

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

2、安装gop

 

 这就有点尴尬了

 

 是个啥

程序员的标准动作

摆个度

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

先去下载go

 

 

 

 

 

胜利就在眼前

 高兴太早

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"

安装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

意思很明显了

那就new一个

 执行一下 ./all.bat

安装成功

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.

验证环境

按直觉都行不通 

查看gop的bin目录

 

 

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

Usage:

        gop <command> [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 <command>" for more information about a command.

验证成功

四、DEMO实战

官方例子

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

The Go+ Playground (goplus.org)

1、允许结果

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+,容易给使用者产生误导;源码中是有依赖的

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

“我的Go+语言初体验” | 征文活动进行中......

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

未来AI编程

共鸣===鼓励 打赏您随意

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值