- 博客(6)
- 资源 (1)
- 收藏
- 关注
原创 Go中依赖注入工具的实现原理,基于github.com/google/wire的源码分析
go 依赖注入工具的实现。 版本 github.com/google/wire ducumentation: 官方文档 这个工具有两个主要的核心观念一个是 provider sets 一个是 injector, injector 根据 provider中的依赖定义生成 factory 函数,算是一个代码生成工具吧,比较好用。 import ( // ... "github.com/google/wire" ) 库本身:"github.com/google/wire" 这里面的代码没有任何
2021-12-21 14:58:18
651
原创 Go1.18beta,浅谈泛型实现原理
Go 1.18 Release Notes 编译后的代码实际上有两份。一个是给 Float 准备的, 一个是给int准备的,有个疑问是传入的是两个参数,一个是栈上的数据,一个是静态数据,静态数据用于在里面给interface初始化用。 可能是这样的。 为什么要搞个 .dic.func ?? 不麻烦吗? 如果内置的数据一样呢,struct 数据呢? 内置数据一样的情况: type mytype int var a mytype = 1 Printkk(a) 如果underlying的数据结构是一样的,
2021-12-19 17:59:24
602
原创 Go中的反射、interface的使用和原理,基于go-querystring/query的源码分析
版本: github.com/google/go-querystring v1.1.0 使用方法: query.Values(opt) 用来解析一个 struct 结构题: 调用方: func main () { type Options struct { Query string `url:"q"` ShowAll bool `url:"all"` Page int `url:"page"` } opt := Options{ "foo", true, 2 }
2021-12-19 15:45:46
435
原创 文件和操作系统--技术文章分享 02
The Perils of File Typing 文章连接: https://invisibleup.com/articles/34/ 问题来源 Suppose you double-click on a file on your computer. You’re doing this so you can open the file and work with it. But does your operating system know what that means? How does it kn
2021-09-11 21:45:53
86
原创 【飞桨】paddle 目标检测第一天笔记
【飞桨】paddle 目标检测第一天笔记 paddle 目标检测第一天笔记: 基础知识: #------ leave layer (input or pump) x = fluid.layers.data(name='x', shape=[13], dtype='float32') x = fluid.layers.create_tensor(name='x', shape=[13], dtype='float32') y = fluid.layers.data(name='y', shape=[1], d
2020-09-22 19:00:03
451
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人