vscode直接运行提示找不到路径,但是mac terminal就可以直接运行

来源:1-5 vscode 的安装和配置

王子虾2021

2021-07-11

vscode运行
[Running]
go run “/Users/yuze/Documents/dev_fun/gofun/src/miaosha_project/test/main.go”

src/miaosha_project/test/main.go:6:2: no required module provides package github.com/kataras/iris/v12: go.mod file not found in current directory or any parent directory; see ‘go help modules’

mac terminal运行
go run “/Users/yuze/Documents/dev_fun/gofun/src/miaosha_project/test/main.go”

yuze@yuze-dev miaosha_project $ go run "/Users/yuze/Documents/dev_fun/gofun/src/miaosha_project/test/ma
in.go"
Now listening on: http://localhost:8080
Application started. Press CMD+C to shut down.

写回答

2回答

王子虾2021

提问者

2021-07-11

一个插件背锅,导致目录一直找不到。需要把勾√打上

Code-runner: File Directory As Cwd

Whether to use the directory of the file to be executed as the working directory.


0
0

王子虾2021

提问者

2021-07-11

路径都是存在的,非常奇怪,怀疑是不是vscode哪里配置有问题,导致go run的时候找到了别的目录去了

../../pkg/mod/github.com/kataras/iris/v12\@v12.1.8/


setting.json里面也有两个目录

"go.gopath": "/Users/yuze/Documents/dev_fun/gofun",

"go.goroot": "/usr/local/go",


0
0

Google资深工程师深度讲解Go语言 由浅入深掌握Go语言

语法+分布式爬虫实战 为转型工程师量身打造

5995 学习 · 1909 问题

查看课程