环境
电脑:
Mac m1 芯片;
系统版本
14.2.1 (23C71)
IDE 环境
GoLand 2023.3.1
go 编译版本
go version go1.21.5 darwin/arm64
go 环境变量配置
现象
我是准备使用 selenium 包开发自动化网页测试,发现 go get 后,跳转到 selenium 包时,提示 Cannot find declaration to go to。我尝试把项目复制到 go 环境变量配置的工作目录时(/Users/shics/workspace),发现可以跳转到 selenium 中。于是,我断定是 go 配置出现了问题;
从网上看了很多解决方案,仍然是没有解决;最终在 chatGpt 的协助下,幸运的解决;
解决
在 Goland IDE 中,点击 Settings -> Go -> Go Modules -> Enable Go modules integration
启用 Go 模块集成就可以了