mac vscode could not import /github.com/gin-gonic/gin

米斯特程序猿 2021年12月05日 670次浏览

解决在 mac 上使用 vscode 学习 golang ,按照官方文档导入 gin 包后提示找不到模块问题

按照如下操作解决 could not import /github.com/gin-gonic/gin

  • go get -u github.com/gin-gonic/gin
  • go mod init gin
  • go mod edit -require github.com/gin-gonic/gin@latest