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

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

安装成功


      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+语言初体验” | 征文活动进行中......

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

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

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

作者其他文章

评论(0

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

    全部回复

    上滑加载中

    设置昵称

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

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

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