cannot find package "golang.org/x/sync/syncmap" in any of:
/usr/local/go/src/golang.org/x/sync/syncmap (from $GOROOT)
/home/tankweight/golang/gopath/src/golang.org/x/sync/syncmap (from $GOPATH)
问了下度娘,又是伟大的墙
mkdir -p $GOPATH/src/golang.org/x
cd $GOPATH/src/golang.org/x
git clone https://github.com/golang/net.git
git clone https://github.com/golang/sync.git
git clone https://github.com/golang/text.git 这个库也顺手clone了
https://godoc.org/golang.org/x/sync/syncmap
是个并发安全的map,go这一点比C++强。
type Map = sync.Map
Package syncmap provides a concurrent map implementation. This was the prototype for sync.Map which was added to the standard library's sync package in Go 1.9. https://golang.org/pkg/sync/#Map.
本文详细介绍了如何解决在Go项目中遇到的'cannotfindpackage'golang.org/x/sync/syncmap'错误。通过正确配置GOPATH并从GitHub克隆所需的库,可以成功导入并发安全的map组件。

1200

被折叠的 条评论
为什么被折叠?



