duanan6043 2019-07-07 09:39
浏览 102
已采纳

在CI文件中进行gofmt项目是否有意义

I came across a project which has this line in its gitlab-ci.yml
go fmt $(go list ./... | grep -v /vendor/) which is followed by a go test and then a go build.
The problem is by this point the code is already committed so there is no point in doing a gofmt or am i missing something here.

  • 写回答

1条回答 默认 最新

  • du5407 2019-07-07 10:12
    关注

    Depends on what the goal is. It may be totally sane to do if a later linter checks whether code is in the proper gofmt format and

    • they know some forget that and they want to ignore that case for a better experience.
    • some generated code is not formatted but also not checked in and so must be gofmt'ed to avoid linter complaints.

    Or it just copied over from somewhere else and no one cared to remove it.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 docker环境配置
  • ¥20 绿盟安全扫描--检测到目标站点存在javascript框架库漏洞
  • ¥30 Android STD快速启动
  • ¥15 如何使用simulink建立一个永磁同步直线电机模型?
  • ¥30 天体光谱图的的绘制并得到星表
  • ¥15 PointNet++的onnx模型只能使用一次
  • ¥20 西南科技大学数字信号处理
  • ¥15 有两个非常“自以为是”烦人的问题急期待大家解决!
  • ¥30 STM32 INMP441无法读取数据
  • ¥15 R语言绘制密度图,一个密度曲线内fill不同颜色如何实现