dssj88098 2019-08-09 10:41
浏览 305
已采纳

为什么“ go vet”仅在某些版本的Go中抱怨? [关闭]

Today I included 'go vet' in one of my pipelines that builds a go service. I wonder why go vet's output on my local machine is different from the one that runs on the CI server.

I figured out that the go version differs - at least a bit. My local Go version is 1.12.4 and the CIs is version 1.12.7. This fact would explain the different behaviour, but I don't get why this happens!

There is the smell:

type Something struct {
    ...
    BatteryNumber string    `json:"number"`
    ...
}

type SomethingWithBattery struct {
    Something
    Number            string   `json:"number"`
    ...
}

So, two times 'number' in the struct tags, because Something-struct is nested SomethingWithBattery - 1.12.4 complains, 1.12.7 does not. Why?

  • 写回答

1条回答 默认 最新

  • doujian7132 2019-08-09 10:54
    关注

    Go 1 and the Future of Go Programs

    Tools

    Finally, the Go toolchain (compilers, linkers, build tools, and so on) is under active development and may change behavior. This means, for instance, that scripts that depend on the location and properties of the tools may be broken by a point release.


    go vet is under active development and recently it has been rewritten. There is no compatibility guarantee for tools, only the language.


    cmd/vet: Consider reverting tag conflict for embedded fields #30465

    go vet fails due to intended shadowing of embedded fields with json tags.


    Also, bug fixes are applied to the Go tools. For example, Issue 30465.

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

报告相同问题?

悬赏问题

  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的
  • ¥15 r语言蛋白组学相关问题
  • ¥15 Python时间序列如何拟合疏系数模型