It would be easier to discuss this in the #telegraf-dev channel on Slack but anyway…
The files in /all are there to be able to import all plugins by Telegraf. If you want to create a Telegraf binary tailored to your configuration you can “customize” it with a tool and build the custom version. A nice readup can be found in this blog post…
Is this what you are looking for? If not, what are you trying to do?
My usecase is - I’m trying to keep only the custom plugins and remove the remaining plugins so that my go.mod file doesn’t carry unused dependencies.
This way I can maintain the telegraf application easily.
Now my doubt is, if I remove the go files related to these unused plugins from the /all folder will the dependencies be removed from go.mod.
You don’t need to delete anything, if you set the build tags accordingly, the plugin packages will not be used and as a consequence the dependencies in the go.mod files will not be pulled into the resulting binary. I suggest you try the customization mentioned in the blog-post and check the results…