devying / devying.github.io Goto Github PK
View Code? Open in Web Editor NEWHome Page: https://devying.github.io/
Home Page: https://devying.github.io/
https://devying.github.io/2018/01/13/golang%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B%E6%80%BB%E7%BB%93/
基本类型 类型 长度 默认值 说明 bool 1 false byte 1 0 uint8 rune 4 0 Unicode Code Point, int32 int, uint 4或8 0 32 或 64 位 int8, uint8 1 0 -128 ~ 127, 0 ~ 255 int16, uint16 2 0 -32768 ~ 32767, 0 ~ 655
https://devying.github.io/2018/05/28/golang%E6%8E%A5%E5%8F%A3/
定义接口代表一种调用契约,是多个方法声明的集合从内部看接口本身也是一种结构类型,只是编译器会对其作出很多限制。 不能有字段 不能定义自己的方法 只能声明方法不能实现 可嵌入其他接口类型接口通常以er作为名称后缀,方法名是声明组成部分,但是参数可不同或者省略。123456789101112131415161718192021222324type tester interface { te
https://devying.github.io/2018/04/19/golang%E7%BB%93%E6%9E%84%E4%BD%93/
结构字段名必须唯一,可以用”_”来部位,支持使用自身指针类型成员。字段名、排列顺序属类型组成部分。除对齐处理外,编译器不会优化,调整内存布局。 1234567891011121314151617type node struct { _ int id int next *node}func main() { n1 := node{ id: 1, &
https://devying.github.io/2018/01/01/golang%E5%8F%98%E9%87%8F%E5%92%8C%E5%B8%B8%E9%87%8F/
变量Go变量总是有固定的数据类型,类型决定了变量内存的长度和存储格式。我们只能修改变量值,无法改变类型。 通过类型转换或者指针操作,我们可以用不同方式修改变量值,但是这并不意味着改变了变量类型。 关键字var可以用于定义变量,运行时内存分配操作会确保变量自动初始化为二进制零值,避免出现不可预测行为。如果显式提供初始化值,可以省略变量类型,由编译器推断。 123var x int //自动初始化
https://devying.github.io/2018/05/19/golang%E6%96%B9%E6%B3%95/
定义方法是对象实例绑定的特殊函数,方法和函数的区别是前者有前置实例接收参数(receiver),编译器以此确定方法所属类型。我们可以为当前包,以及除接口和指针以外的任何类型定义方法。 12345678910type N intfunc (n N) toString() string { return fmt.Sprintf("%#x", n)}func main() {
https://devying.github.io/2018/03/25/golangmap/
字典作为无序键值对集合,字典要求val必须是支持相等运算符(==,!=)的数据类型,比如数字、字符串、指针、数组、结构体,以及对应接口类型。访问不存在的键值,默认返回零值,不会引发错误。但是推荐使用ok-idiom模式对字典进行迭代的时候每次返回的键值顺序都是不一样的。字段不支持cap。因内存访问安全和哈希算法等缘故,字段被设计成”not addressable”,故不能直接修改value成员(结
https://devying.github.io/2018/02/03/golang%E5%AD%97%E7%AC%A6%E4%B8%B2/
字符串字符串是不可变字节(byte)序列,其本身是一个复合结构 1234type stringStruct struct{ str unsafe.Pointer len int} 头部指针指向字节数组,但没有NULL结尾。默认以UTF-8编码存储Unicode字符,字面量里允许使用十六进制、八进制和UTF编码格式。内置函数len返回字节数组长度,cap不接受字符串类
https://devying.github.io/2018/02/25/golang%E6%95%B0%E7%BB%84/
数组定义定义数组类型时,数组长度必须是非负整数常量表达式,长度是类型组成部分。也就是说,元素类型相同,但是长度不同的数组不属于同一类型。 12345var a [4]intb := [4]int{2,5} //未初始化的元素自动初始化为0c := [4]int{5,3:10} //可以指定索引位置初始化d := [...]int{12,13,14&
https://devying.github.io/2018/03/10/golang%E5%88%87%E7%89%87/
切片切片本身并非动态数组或者数组指针。它内部通过指针引用底层数组,设定相关属性将数据读写操作限定在指定区域内。切片本身是个只读对象,其工作机制类似于数组指针的一种包装demo: 1234567891011121314151617181920212223x := [...]int{0,1,2,3,4,5,6,7,8,9}expression slice
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.