我用谷歌搜索了一下,但没有得到答案.有可能吗?如果是,怎么做?
Goplayground 链接:https://play.golang.org/
我用谷歌搜索了一下,但没有得到答案.有可能吗?如果是,怎么做?
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 atgolang/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()
返回v1
和v1
的元素乘积之和
重点是:gonum/mat
是Go Standard Library的not部分.
原始答案:
关于围棋playground 的最完整的文章仍然是"Inside the Go Playground",其中提到:
godoc/static/static.go
(用于操场上显示的默认围棋程序)golang/tools/playground
用于源代码,playground/socket/socket.go
用于从操场编辑器构建和执行程序.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代码,因此仍然不允许外部导入.