VS Code won't let me save a go test file

192 views Asked by At

I'm trying to save a file with VS Code.

UPDATE

I guess I should have asked how, independent of what the code is, you can force VS Code to Save a file when you hit Ctrl S rather than editing your file and then saving it?

====

VS Code is reporting a problem here:

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

and outputting:

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

When I Ctrl S, VS Code removes the line.

It may be a problem but I'd like to be able to save and test it.

I guess:

  1. how do I save the file?

(Note I can do it with vim but would like to know how you do it with VS Code)

1

There are 1 answers

0
Snowcrash On BEST ANSWER

99.9% of the time you're fine with VS Code.

For that 0.1% of the time when you're having problems saving a file using VS Code and don't have time to waste a few hours on working out why, just use vim.