I got a couple of good ideas from Will F. for coping with it.   Also, I 
tried Vim-Go.   Then I bit the bullet and bought Goland (not too pricey for 
a personal license). 

Goland had the same behavior (arghh) but after a long conversation with 
their chatbot, it came down to this: 

1) Go to Actions on Save in the settings, and disable two actions, Format 
Code and Optimize Imports.   2) When I want those things to happen, press 
option-cmd-L for Format Code, or ctrl-option-O for Optimize Imports. 

That solves it for me, for now.   Maybe writing it down will help someone 
else. 

On Tuesday, November 18, 2025 at 12:48:55 PM UTC-6 [email protected] wrote:

> Hi.   I type 
>
> import "github.com/zalando/go-keyring" 
>
> and save, and VSCode deletes my line. 
>
> I know why it's doing it.  I haven't yet used the library in my routine, 
> and I have yet added the library to my go.mod file. 
>
> But I want it to inform me of the problem, and leave it to me to fix it!  
> Not change my code without my permission.  (My Prius yanks the wheel when 
> it thinks I'm about to hit something.  Not appreciated.) 
>
> Is there some set of settings that will accomplish this?  I hate to 
> abandon VSCode.  The Go team has put in a lot of effort to make it the best 
> place to write Go code.  Thanks. 
>
> Keywords:   VSCode autoformat format formatonsave 
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/golang-nuts/8032f71e-d39a-4ce2-8d73-ed5c4dede9ean%40googlegroups.com.

Reply via email to