Re: [go-nuts] GoImports version

2024-10-18 Thread Jan Mercl
On Fri, Oct 18, 2024 at 9:17 AM 'Axel Wagner' via golang-nuts wrote: > I tried it out and the format parsed by debug.ParseBuildInfo is almost > exactly what is output by go version -m: > https://go.dev/play/p/L-MNzr0EnjV > (and yes, my goimports version is old) And https://go.dev/play/p/bgeGr2h

Re: [go-nuts] GoImports version

2024-10-18 Thread 'Axel Wagner' via golang-nuts
Damn, I keep forgetting that I had other stuff to say: My main concern with this approach is that the BuildInfo embedded into binaries is incomplete in a bunch of circumstances - for example, if you clone the repository and run `go build` in it (I believe) or if someone uses a `goimports` version w

Re: [go-nuts] GoImports version

2024-10-18 Thread 'Axel Wagner' via golang-nuts
On Fri, 18 Oct 2024 at 08:20, Kurtis Rader wrote: > And, obviously, how do you handle a command named "goimports" installed by > the user that is not from the golang.org/x/tools repository. > I'll note that it should be trivial to check if the BuildInfo.Main.Path is golang.org/x/tools and BuildI

Re: [go-nuts] GoImports version

2024-10-18 Thread 'Axel Wagner' via golang-nuts
I tried it out and the format parsed by debug.ParseBuildInfo is almost exactly what is output by go version -m: https://go.dev/play/p/L-MNzr0EnjV (and yes, my goimports version is old) On Fri, 18 Oct 2024 at 08:20, Kurtis Rader wrote: > On Thu, Oct 17, 2024 at 10:31 PM shan...@gmail.com > wrote

Re: [go-nuts] GoImports version

2024-10-17 Thread Kurtis Rader
On Thu, Oct 17, 2024 at 10:31 PM shan...@gmail.com wrote: > I have a need to (programatically) check what version of `goimports` > someone has installed on their system. > It might help if you told us why you need to do that. The answer by Axel Wagner is somewhat helpful but the output of "go v

Re: [go-nuts] GoImports version

2024-10-17 Thread shan...@gmail.com
Awesome, I think that that will work for us FTR, I hadn't realised that `gopls` usurped `goimports` - I shall be updating my ~/.vimrc forthwith :) On Friday, October 18, 2024 at 3:44:18 PM UTC+10 Axel Wagner wrote: > You can look at `go version -m /path/to/goimports` to get the version of > th

Re: [go-nuts] GoImports version

2024-10-17 Thread 'Axel Wagner' via golang-nuts
You can look at `go version -m /path/to/goimports` to get the version of the golang.org/x/tools module. I seem to remember that there was a way to get that information out of a binary programatically as well, but I can't find it right now. You might try to look at what the `go version` command does

[go-nuts] GoImports version

2024-10-17 Thread shan...@gmail.com
Hi all, I have a need to (programatically) check what version of `goimports` someone has installed on their system. I cannot, for the life of me, figure out if there's a way to do it other than https://groups.google.com/g/golang-nuts/c/in9IVmPc_fQ/m/O4vYNNAZCQAJto golang-nuts hey brad, is i