Golang Set库(Golang-Set)未编译
我正在使用此集库 golang-set 。尝试创建一个集合时,我会收到以下错误:
invalid operation: cannot index mapset.NewSet (value of type func(s ...interface{}) mapset.Set)
这是我使用的GO版本1.18.2在Ubuntu上的完整代码
package main
import (
mapset "github.com/deckarep/golang-set"
)
func main() {
mySet := mapset.NewSet[string]()
}
,该代码正是文档中它显示的方式。
I was using this set library golang-set. I get the following error when trying to create a set:
invalid operation: cannot index mapset.NewSet (value of type func(s ...interface{}) mapset.Set)
Here is the full code
package main
import (
mapset "github.com/deckarep/golang-set"
)
func main() {
mySet := mapset.NewSet[string]()
}
I'm using go version 1.18.2 on Ubuntu, the code is exactly how it appears on the documentation.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如约阿希姆·伊萨克森(Joachim Isaksson)指出的那样,应该和
GO中的进口。版本应该为2xx,截至目前为2.1.0
As Joachim Isaksson noted, it should be imported as
also in go.mod the version should be 2xx, as of now it is at 2.1.0