Is there an autoloader in Go?

Asked 2 years ago, Updated 2 years ago, 63 views

I write it on the import tag every time, so it seems a little difficult to operate.
Is it good manners to do goimports-w?

go

2022-09-30 10:43

1 Answers

Is it good manners to do goimports-w?

It seems to be that kind of culture.
To be exact, it is customary to use gofmt after editing the code, and people who want to automate the description of import use goimports instead of gofmt.

For example, vim's plug-in for Golangvim-go automatically runs gofmt when saving files, but the following configuration also introduces the use of goimports:

Enable goimports to automatically insert import paths installed of gofmt:
letg:go_fmt_command="goimports"

https://github.com/fatih/vim-go


2022-09-30 10:43

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.