Mike,

I get the same results for go1.22 and go1.23 as I got for go (devel go1.24).

I indented the src/cmd/tools/tools.go file import statement by a tab to 
force a reformat.

~/go1.22/src/cmd/tools$ go1.22 version
go version go1.22.6 linux/amd64

~/go1.22/src/cmd/tools$ go1.22 fmt
tools.go

~/go1.22/src/cmd/tools$ go1.22 build
package cmd/tools: build constraints exclude all Go files in 
/home/peter/go1.22/src/cmd/tools
~/go1.22/src/cmd/tools$ go1.22 build -tags=tools
tools.go:11:8: import "golang.org/x/tools/cmd/bisect" is a program, not an 
importable package
~/go1.22/src/cmd/tools$ 

and

~/go1.23/src/cmd/tools$ go1.23 version
go version go1.23.0 linux/amd64

~/go1.23/src/cmd/tools$ go1.23 fmt
tools.go

~/go1.23/src/cmd/tools$ go1.23 build
package cmd/tools: build constraints exclude all Go files in 
/home/peter/go1.23/src/cmd/tools
~/go1.23/src/cmd/tools$ go1.23 build -tags=tools
tools.go:11:8: import "golang.org/x/tools/cmd/bisect" is a program, not an 
importable package
~/go1.23/src/cmd/tools$ 

peter



On Saturday, August 31, 2024 at 8:22:32 AM UTC-4 Mike Schinkel wrote:

> Hi Alex & Peter,
>
> Thank you both for your replies.
>
> On Aug 30, 2024, at 2:43 AM, Axel Wagner <axel.wa...@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, 
> 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.pe...@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/bec18f16-15e1-445f-b1ef-eb8d10d5aebcn%40googlegroups.com.

Reply via email to