我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

是否可以为自定义类型覆盖len函数的行为?

I've defined a custom type which consists of, among other things, an unexported array. What I'm wondering is, is there a way for me to override the implementation of the len() function for my custom type without having to export the array?

Thanks.

No. You can however add a Len() method to your type.

近期文章

  • Golang嵌入式结构
  • 在一种情况下检查密钥是否存在于多个地图中
  • Golang调用CUDA库
  • 使用Go读取XML元素的内部文本
  • 在一个语句中执行映射查找和类型声明是“坏形式”吗?
  • 无论类型如何,反序列化ObjectMeta
  • 接口中是否存在不相关的方法会破坏文本/模板?
  • 无法让Json显示在Ag Grid中只是说正在加载
  • golang可有效处理Null *类型
  • 我可以在Google App Engine(标准环境)中使用Goroutines吗?
  • “所选目录不是Go SDK的有效主目录”
  • Android Studio和Go?
  • 有没有更好的方法来限制“门”上的请求?
  • Golang Cloud SDK-gcloud应用部署无法找到导入包
  • 遍历Struct中的字符串字段
  • 在Go中将CSV记录解组为struct
  • Go中if条件的非布尔值
  • 如何将unix时间戳格式化为RFC3339-Golang?
  • 使用基本auth和formvalue进行Http Post请求
  • Go中的预定轮询任务

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华