V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
c3de3f21
V2EX  ›  问与答

Q: go 有没有重排函数的工具

  •  
  •   c3de3f21 · 327 天前 · 461 次点击
    这是一个创建于 327 天前的主题,其中的信息可能已经有所发展或是发生改变。

    比如写的时候随便写了直接

    type Person struct{}
    
    func init(){}
    
    func (p *Person)say(){}
    
    var p *Person
    
    func NewPerson()*Person{
    ...
    ...
    return p
    }
    
    func (p *Person)aha(){}
    
    

    当我保存或者手动 format 的时候触发 lint 把我的格式变为

    var p *Person
    type Person struct{}
    func init(){}
    func NewPerson()
    func (p *Person) say()
    func (p *Person) aha()
    
    2 条回复    2023-06-25 17:37:47 +08:00
    c3de3f21
        1
    c3de3f21  
    OP
       327 天前
    符合调用层次依次向下的或者有规律有结构的 lint
    lilei2023
        2
    lilei2023  
       327 天前
    这个功能确实好,目前使用 goland 貌似没发现有这个功能
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2384 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 01:54 · PVG 09:54 · LAX 18:54 · JFK 21:54
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.