Hi Alex & Peter,

Thank you both for your replies.

> On Aug 30, 2024, at 2:43 AM, Axel Wagner <axel.wagner...@googlemail.com> 
> wrote:
> I don't think that error message comes from gofmt. As far as I am aware, 
> gofmt only parses source code, it does not even do type-checking.

As you sure about that?  Running this:

go fmt ./tools.go

Generates this error for me using go1.23.0 (vs. go1.22.x):

tools.go:9:2: import "github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen" 
is a program, not an importable package

> FWIW you might be interested in https://github.com/golang/go/issues/48429 
> <https://github.com/golang/go/issues/48429>, which gives a less hacky way to 
> track tool dependencies and which (as far as I know) has been accepted and is 
> being implemented, with some delays due to team changes. So, for the concrete 
> issue, a solution is already being worked on.

Thank you for that link. I will look into that for longer term.  

Shorter term, though it would be nice to find a way to resolve this.

> On Aug 30, 2024, at 9:14 AM, peterGo <go.peter...@gmail.com> wrote:
> Let's use official Go sources.
> 
> go/src/cmd/tools/tools.go:
> 
> Indent the tools.go import statement by a tab to force a reformat.
> 
> $ go fmt 
> tools.go
> $ 
> 
> Attempt to build package tools.
> 
> $ go build
> package cmd/tools: build constraints exclude all Go files in 
> /home/peter/go/src/cmd/tools
> $ go build -tags=tools 
> tools.go:11:8: import "golang.org/x/tools/cmd/bisect" is a program, not an 
> importable package
> $ 
> 
> Looks like a go build generated error.

Have you tried `go fmt` on `tools.go` with go1.23?  

I tried with go1.22.6 just now and it did not generate an error, but it does 
with go1.23.0.

-Mke

-- 
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/BAF7DCC6-BF26-4291-B9F4-09448EEC0A93%40newclarity.net.

Reply via email to