【问题标题】:VS Code won't let me save a go test fileVS Code 不允许我保存 go 测试文件
【发布时间】:2021-07-16 12:11:39
【问题描述】:

我正在尝试使用 VS Code 保存文件。

更新

我想我应该问一下,独立于代码是什么,您可以在按下 Ctrl S 时强制 VS Code 保存文件,而不是编辑文件然后保存它?

====

VS Code 在这里报告问题:

import (
    "fmt"
    "testing"
    "github.com/gruntwork-io/terratest/modules/terraform"
)

并输出:

could not import github.com/gruntwork-io/terratest/modules/terraform (cannot find package "github.com/gruntwork-io/terratest/modules/terraform" in any of 
/usr/local/go/src/github.com/gruntwork-io/terratest/modules/terraform (from $GOROOT)
/home/snowcrash/go/src/github.com/gruntwork-io/terratest/modules/terraform

当我 Ctrl S 时,VS Code 删除该行。

这可能是个问题,但我希望能够保存并测试它。

我猜:

  1. 如何保存文件?

(注意我可以用vim 来做,但想知道你是如何用 VS Code 做的)

【问题讨论】:

  • 你读过如何在 Go 中导入依赖吗?您可能会发现 golang.org/doc/code#ImportingRemote 很有用。

标签: visual-studio-code terraform terratest


【解决方案1】:

99.9% 的时间你都可以使用 VS Code。

当您在使用 VS Code 保存文件时遇到问题并且没有时间浪费几个小时来找出原因时,有 0.1% 的时间使用 vim。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-07-06
    • 2016-05-24
    • 2021-03-28
    • 1970-01-01
    相关资源
    最近更新 更多