dousong2023 2014-11-15 04:47
浏览 34

默认命令行参数值存在编译错误

As I try to take a command line argument of type uint64, when I am setting default value to a valid unsigned 64 bit number, I am getting following compilation error.

Compilation Error: Expression type mismatch, the expected type is uint64 less... It highlights the number 5000 here indicating that's not an acceptable value.

Code:

var golferInstance uint64 

flag.Uint64Var(&golferInstance, "inst", 5000, "Golfer Instance ID, this should be Globaly Unique ")
flag.Parse()

I don't see anything wrong with above declaration, then why is the compilation error ??

What am I missing here? (i believe must be something silly that i fail to make out) Any help is appreciated.

Thanks

  • 写回答

1条回答 默认 最新

  • duanbinren8906 2014-11-15 08:00
    关注

    The Inspection type in the go-lang-idea-plugin has some issues regarding certain type Mismatch detection.
    See issue 348 (which is supposed to be solved in latest version of that plugin)

    You can un-select that inspector.

    In the interface it's called 'Highlight mismatched types', I believe this is the one.
    The message from inspection is: 'Expression type mismatch, expected type is ...'

    It also seems it has problems in detecting that '1 * time.Second' in the construct 'time.Sleep(1 * time.Second)' is a proper 'Duration' type and it tries to fix it like this 'time.Sleep((time.Duration)(1 * time.Second))'.

    Falling back to command line, and/or making sure all components are up-to-date (golang IntelliJ plugin, Go itself), can help.

    评论

报告相同问题?

悬赏问题

  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大