On Sun, Sep 1, 2024 at 1:08 AM Mike Schinkel <m...@newclarity.net> wrote:
>
> Ian — if you are reading this — does this rise enough to the level of a bug — 
> checking imports on a `go fmt` — that I should submit as an issue on GitHub?

This is, perhaps unfortunately, expected behavior.

The "go fmt" command is the "fmt" subcommand of the "go" command.  It
takes a list of packages.  If no package is listed, it applies to the
current directory.  Because it is part of the "go" command, it looks
at imports, finds packages, and does other things that the "go"
command does.  The docs are at
https://pkg.go.dev/cmd/go#hdr-Gofmt__reformat__package_sources.

The "gofmt" command is a simpler command that formats one or more
source files.  If no source files are listed, it reads a Go file on
standard input and emits the formatted version on standard output.
The "gofmt" command is invoked by "go fmt".  The "gofmt" command has
more options than the "go fmt" command, but on the other hand it won't
find packages for you.  The docs are at https://pkg.go.dev/cmd/gofmt.

This has been discussed before, for example
https://groups.google.com/g/golang-nuts/c/t-tSHt8RG-4,
https://go.dev/issue/33263, https://go.dev/issue/35258.

Ian

-- 
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 golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcW_EKJcjR57SrqkA5wBpArCixv69hWHbVm9-AXjDNdN7g%40mail.gmail.com.

Reply via email to