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

举报
隔壁老汪 发表于 2022/06/24 01:16:01 2022/06/24
【摘要】 一、入门简介 英文介绍 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...

一、入门简介

英文介绍

  • 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

安装成功


  
  1. D:\git\2021\goplus\gop>go run cmd/install.go --install --autoproxy
  2. Installing Go+ tools...
  3. golang.org/x/xerrors/internal
  4. golang.org/x/mod/semver
  5. github.com/goplus/gop/x/mod/internal/lazyregexp
  6. github.com/goplus/gop/token
  7. github.com/goplus/gop/scanner
  8. github.com/qiniu/x/log
  9. golang.org/x/mod/internal/lazyregexp
  10. github.com/goplus/gop/env
  11. golang.org/x/xerrors
  12. github.com/goplus/gox/internal/go/printer
  13. github.com/goplus/gop/ast
  14. github.com/goplus/gox/internal
  15. golang.org/x/sys/execabs
  16. golang.org/x/mod/module
  17. github.com/goplus/gox/internal/go/format
  18. github.com/goplus/gop/parser
  19. golang.org/x/tools/internal/typeparams
  20. github.com/goplus/gop/x/mod/modfile
  21. golang.org/x/mod/modfile
  22. golang.org/x/tools/internal/event/label
  23. golang.org/x/tools/internal/event/keys
  24. golang.org/x/tools/go/internal/gcimporter
  25. golang.org/x/tools/internal/typesinternal
  26. golang.org/x/tools/go/ast/astutil
  27. github.com/goplus/gop/cmd/internal/modfetch
  28. golang.org/x/tools/internal/event/core
  29. golang.org/x/tools/go/types/typeutil
  30. golang.org/x/tools/go/gcexportdata
  31. github.com/goplus/gop/cmd/internal/search
  32. github.com/goplus/gop/printer
  33. golang.org/x/tools/internal/event
  34. github.com/goplus/gop/cmd/goptestgo
  35. golang.org/x/tools/internal/gocommand
  36. github.com/goplus/gop/format
  37. github.com/goplus/gop/cmd/gopfmt
  38. golang.org/x/tools/go/internal/packagesdriver
  39. golang.org/x/tools/internal/packagesinternal
  40. golang.org/x/tools/go/packages
  41. github.com/goplus/gox
  42. github.com/goplus/gop/cl
  43. github.com/goplus/gop/cmd/gengo
  44. github.com/goplus/gop/x/gopmod
  45. github.com/goplus/gop/cmd/internal/modload
  46. github.com/goplus/gop/cmd/internal/base
  47. github.com/goplus/gop/cmd/goprun
  48. github.com/goplus/gop/cmd/internal/build
  49. github.com/goplus/gop/cmd/internal/clean
  50. github.com/goplus/gop/cmd/internal/env
  51. github.com/goplus/gop/cmd/internal/gengo
  52. github.com/goplus/gop/cmd/internal/gopfmt
  53. github.com/goplus/gop/cmd/internal/help
  54. github.com/goplus/gop/cmd/internal/install
  55. github.com/goplus/gop/cmd/internal/mod
  56. github.com/goplus/gop/cmd/internal/run
  57. github.com/goplus/gop/cmd/internal/test
  58. github.com/goplus/gop/cmd/internal/version
  59. github.com/goplus/gop/cmd/gop
  60. Go+ tools installed successfully!
  61. Next:
  62. We just installed Go+ into the directory: D:\git\2021\goplus\gop\bin
  63. To setup a better Go+ development environment,
  64. we recommend you add the above install directory into your PATH environment variable.

验证环境

按直觉都行不通 

查看gop的bin目录

 

 


  
  1. PS D:\git\2021\goplus\gop\bin> .\gop.exe
  2. Gop is a tool for managing Go+ source code.
  3. Usage:
  4. gop <command> [arguments]
  5. The commands are:
  6. run Run a Go+ program
  7. go Convert Go+ packages into Go packages
  8. fmt Format Go+ packages
  9. mod module maintenance
  10. install Build Go+ files and install target to GOBIN
  11. build Build Go+ files
  12. clean Clean all Go+ auto generated files
  13. env prints Go+ environment information.
  14. test Test Go+ packages
  15. version Version prints the build information for Gop executables
  16. 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、写入代码


  
  1. package main
  2. import "fmt"
  3. func main() {
  4. fmt.Println([]float64{1, 2, 3.4})
  5. }

4、运行命令

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

使用感想

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

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

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

文章来源: blog.csdn.net,作者:隔壁老瓦,版权归原作者所有,如需转载,请联系作者。

原文链接:blog.csdn.net/wxb880114/article/details/121665748

【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。