我用谷歌搜索了一下,但没有得到答案.有可能吗?如果是,怎么做?

Goplayground 链接:https://play.golang.org/

推荐答案

2019年5月14日起it is now possible(Brad Fitzpatrick起)!

#Golang操场现在支持第三方导入,通过https://proxy.golang.org/将其吸引进来

示例:https://play.golang.org/p/eqEo7mqdS9l?

Multi-file support & few other things up next.
Report bugs at golang/go issue 31944, or here on the tweeters.

(在"multiple file" support号上,见,自5月以来.2019年16日,"Which packages may be imported in the go playground?":见AN example here)

netbrain表示in the comments,另example表示:

在操场上:

package main

import (
    "fmt"

    "gonum.org/v1/gonum/mat"
)

func main() {
    v1 := mat.NewVecDense(4,[]float64{1,2,3,4})
    fmt.Println(mat.Dot(v1,v1))
}

我们给出‘30’,使用mat.NewVecDense()创建列向量,使用mat.Dot()返回v1v1的元素乘积之和

重点是:gonum/matGo Standard Librarynot部分.


原始答案:

关于围棋playground 的最完整的文章仍然是"Inside the Go Playground",其中提到:

None of those processes support importing a remote package (that would be accessed over the internet).
It is very much a self-contained system (that you can run locally as well as using it from play.golang.org), with multiple features stubbed or faked, like the network:

Like the file system, the playground's network stack is an in-process fake implemented by the syscall package.
It permits playground projects to use the loopback interface (127.0.0.1).
Requests to other hosts will fail.


更新2017:

您有其他 Select :

但他们仍然使用官方的Go Playround服务来构建和运行Go代码,因此仍然不允许外部导入.

Go相关问答推荐

SEARCH On Conflict Clause不考虑乐观锁定版本

如何使用Docker Compose配置Go,使main. go文件位于/CMD文件夹中

正在使用terratest执行terraform脚本测试,但遇到错误退出状态1

Golang Viper:如果第一个字段不存在,如何从另一个字段获取值

如何配置vscode以在Go中显示不必要的(过度指定的)泛型?

我找不到pcap.Openlive的设备名称

Go:如何在不加载正文的情况下创建 http 代理通行证

我们如何保证取消的上下文会导致 goroutine 终止?

如何解决构建Docker Compose时的权限被拒绝问题

Caddy服务器try 打开端口80而不是8090.

在 Go 中解组编号的 XML 标签

golang 中的可变参数函数

速率限制特定端点

vs 代码调试 go 测试不通过标志

有没有办法在 golang 中定义可索引类型?

具有相同提前返回语句的函数的不同基准测试结果

Go 使用 struct 作为接口而不实现所有方法

如何在测试中传递用户名和密码等参数

如何解决在mac m1中运行gcc失败退出状态1?

如何访问Go 1.18泛型 struct (structs)中的共享字段