V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
c3de3f21
V2EX  ›  问与答

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

  •  
  •   c3de3f21 · Jun 25, 2023 · 1053 views
    This topic created in 1038 days ago, the information mentioned may be changed or developed.

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

    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 replies    2023-06-25 17:37:47 +08:00
    c3de3f21
        1
    c3de3f21  
    OP
       Jun 25, 2023
    符合调用层次依次向下的或者有规律有结构的 lint
    lilei2023
        2
    lilei2023  
       Jun 25, 2023
    这个功能确实好,目前使用 goland 貌似没发现有这个功能
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5165 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 09:44 · PVG 17:44 · LAX 02:44 · JFK 05:44
    ♥ Do have faith in what you're doing.