Goland依赖分组管理配置

在Golang中依赖管理范式推荐分组管理

  1. 标准库(SDK)

  2. 第三方依赖

  3. 项目内部依赖

 

效果如图:

import (
	// Go SDK
	"log"
	"sync"

	// Third-party
	"google.golang.org/grpc"
	"google.golang.org/grpc/credentials/insecure"

	// Internal
	"gitlab.api.your_company.com/backend/product/pb/product"
	"your_company/internal/global"
)

 

为了实现这样的效果,我使用的是 goimports-reviser  

其GitHub提供了好几种下载方式

image

通过Goland的File Watcher配置

image

 

保存配置后,默认保存文件的时候,会自动格式化你的依赖分组。

posted @ 2025-09-08 17:56  Ashe|||^_^  阅读(9)  评论(0)    收藏  举报