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 
> 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, as a starting point. 
> It's also the same that debug.ReadBuildInfo 
> <https://pkg.go.dev/runtime/debug#BuildInfo> returns, so that might be a 
> good starting point as well.
>
> I'll also note that many if not most Go users these days probably use 
> gopls rather than goimports.
>
> On Fri, 18 Oct 2024 at 07:31, shan...@gmail.com <shan...@gmail.com> wrote:
>
>> 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 it possible to have a ```goimports version``` so that we 
>> know what versions we currently have?
>>
>> I suggest using the command:go get -u -v golang.org/x/tools/cmd/goimportsThe 
>> -v flag will print packages that are rebuilt. If the output is empty, that 
>> means you already had the latest version. If the output is not empty, that 
>> means you had an outdated version, but now it's up to date.If you want 
>> to find out whether your version is up to date before actually updating it, 
>> you can use gostatus and binstale tools.
>>
>> -- 
>> 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...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/golang-nuts/811798e7-2a10-460b-892d-f214aefdeaf2n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/golang-nuts/811798e7-2a10-460b-892d-f214aefdeaf2n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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/ce4f5e5a-0c88-4894-91e0-8fb835de4d1dn%40googlegroups.com.

Reply via email to