├── README.md ├── l_file ├── .idea │ ├── l_file.iml │ ├── modules.xml │ └── workspace.xml ├── ab.txt ├── bb.txt ├── demo01_fileinfo.go ├── demo02_file.go ├── demo03_read.go ├── demo04_write.go ├── demo05_copy.go ├── demo06_seek.go ├── demo07_seek.go ├── demo08_bufio_r.go ├── demo09_bufio_w.go ├── demo10_ioutil.go ├── demo11.go └── guliang.jpeg └── l_package ├── .idea ├── l_package.iml ├── modules.xml └── workspace.xml ├── l_package ├── main.go ├── person └── person.go ├── pk1 └── test2.go ├── pk2 └── test3.go ├── timedemo.go └── utils ├── timeutils └── timeutil.go ├── util.go └── ytest1.go /README.md: -------------------------------------------------------------------------------- 1 | # 视频列表: 2 | 3 | ## 1.《2019千锋GO语言超详细入门教程(笔记+课件+源码)》 4 | 5 | B站:https://www.bilibili.com/video/av47467197 6 | 7 | 腾讯课堂:https://ke.qq.com/course/390424 8 | 9 | 优酷/土豆:https://v.youku.com/v_show/id_XNDExMzkzMTkxMg==.html 10 | 11 | 千锋视频站:http://video.mobiletrain.org/course/index/courseId/548 12 | 13 | 爱奇艺: 14 | 15 | 56/搜狐:https://my.tv.sohu.com/pl/9541885/index.shtml 16 | 17 | 视频代码github地址:https://github.com/rubyhan1314/go_foundation 18 | 19 | 20 | 21 | ## 2.《2019Golang基础进阶实战编程》(学完基础必看) 22 | 23 | B站:https://www.bilibili.com/video/av56945376 24 | 25 | https://www.bilibili.com/video/av56860636 26 | 27 | 腾讯课堂:https://ke.qq.com/course/419109 28 | 29 | 网易云课堂:https://study.163.com/course/introduction/1209407865.htm 30 | 31 | 千锋视频站:http://video.mobiletrain.org/course/index/courseId/631 32 | 33 | 34 | 35 | 36 | 37 | ## 3.《Goweb开发之Iris框架实战【2019千锋】》 38 | 39 | B站:https://www.bilibili.com/video/av50575135 40 | 41 | 腾讯课堂:https://ke.qq.com/course/398502 42 | 43 | 优酷/土豆:https://v.youku.com/v_show/id_XNDExMzkzMTkxMg==.html 44 | 45 | 千锋视频站:http://video.mobiletrain.org/course/index/courseId/548 46 | 47 | 网易云课堂:https://study.163.com/course/introduction/1209344880.htm 48 | 49 | 50 | 51 | ## 4.《Goweb开发之Beego框架实战【2019千锋】》 52 | 53 | bilibili:https://www.bilibili.com/video/av54075956 54 | 网易云课堂:https://study.163.com/course/introduction/1209344880.htm 55 | 腾讯课堂:https://ke.qq.com/course/411509 56 | 57 | 58 | 59 | ## 5.微服务 60 | 61 | Go语言微服务从入门到大师【2019千锋】 62 | https://ke.qq.com/course/425236 63 | 64 | 65 | 66 | ## 6.《3天精通Go密码学开发实战【2019千锋】》 67 | 68 | 网易云课堂: https://study.163.com/course/introduction/1209330836.htm 69 | 70 | bilibili : https://www.bilibili.com/video/av50557831 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | # 相关资料 79 | 80 | ## 1.Go语言网站 81 | 82 | https://www.qfgolang.com/ 83 | 84 | 85 | 86 | ## 2.github:Golang - 100天从新手到大师 87 | 88 | https://github.com/rubyhan1314/Golang-100-Days 89 | 90 | 91 | 92 | ## 3.知乎 93 | 94 | 知乎:茹姐 95 | 主页:https://www.zhihu.com/people/18511154519/activities 96 | 97 | 知乎:Davie 98 | 99 | 主页:https://www.zhihu.com/people/davie-81-7/activities 100 | 101 | 知乎专栏:https://zhuanlan.zhihu.com/qfgolang 102 | 103 | 104 | 105 | CSDN:千锋教育官方博客 106 | 主页:https://blog.csdn.net/GUDUzhongliang 107 | 108 | 109 | 110 | ## 4.个人博客 111 | 112 | ​ 韩茹: 113 | 114 | ​ 个人博客:https://rubyhan.cn/ 115 | 116 | ​ B站:https://space.bilibili.com/353694001 117 | 118 | ​ Davie: 119 | 120 | ​ 个人博客:https://www.davieyu.cn/ 121 | 122 | ​ B站:https://space.bilibili.com/408228716 123 | 124 | 125 | 126 | 127 | 128 | ## 5. QQ群 129 | 130 | 千锋Go学习营:784190273 131 | 132 | 千锋go语言官方①群:816085262 133 | 134 | go语言学习:376076305 135 | 136 | ![WechatIMG8950](http://7xtcwd.com1.z0.glb.clouddn.com/WechatIMG8950.png) 137 | 138 | -------------------------------------------------------------------------------- /l_file/.idea/l_file.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /l_file/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /l_file/.idea/workspace.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 34 | 35 | 36 | 37 | 57 | 58 | 59 | 60 | 61 | true 62 | DEFINITION_ORDER 63 | 64 | 65 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 218 | 219 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | -------------------------------------------------------------------------------- /l_package/l_package: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubyhan1314/go_advanced/071a8b60589e93253a14f05bdc1487576883b09d/l_package/l_package -------------------------------------------------------------------------------- /l_package/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | _ "l_package/pk1" 5 | 6 | //"database/sql" 7 | //_ "github.com/go-sql-driver/mysql" 8 | //"fmt" 9 | "l_package/pk2" 10 | ) 11 | 12 | //import "l_package/utils" //绝对路径 13 | 14 | //import "./utils" //相对路径 15 | // 16 | //import ( 17 | // "l_package/utils/timeutils" 18 | // "l_package/pk1" 19 | // "fmt" 20 | // p "l_package/person" 21 | //) 22 | func main() { 23 | /* 24 | 关于包的使用: 25 | 1.一个目录下的统计文件归属一个包。package的声明要一致 26 | 2.package声明的包和对应的目录名可以不一致。但习惯上还是写成一致的 27 | 3.包可以嵌套 28 | 4.同包下的函数不需要导入包,可以直接使用 29 | 5.main包,main()函数所在的包,其他的包不能使用 30 | 6.导入包的时候,路径要从src下开始写 31 | */ 32 | //utils.Count() 33 | //timeutils.PrintTime() 34 | // 35 | //pk1.MyTest1() 36 | // 37 | //utils.MyTest2() 38 | // 39 | //fmt.Println("---------------------") 40 | //p1 :=p.Person{Name:"王二狗",Sex:"男"} 41 | //fmt.Println(p1.Name,p1.Sex) 42 | 43 | 44 | /* 45 | init()函数和main()函数 46 | 1.这两个函数都是go语言中的保留函数。init()用于初始化信息,main()用于作为程序的入口 47 | 2.这两个函数定义的时候:不能有参数,返回值。只能由go程序自动调用,不能被引用。 48 | 3.init()函数可以定义在任意的包中,可以有多个。main()函数只能在main包下,并且只能有一个。 49 | 4.执行顺序 50 | A:先执行init()函数,后执行main()函数 51 | B:对于同一个go文件中,调用顺序是从上到下的,也就是说,先写的先被执行,后写的后被执行 52 | C:对于同一个包下,将文件名按照字符串进行排序,之后顺序调用各个文件中init()函数 53 | D:对于不同包下, 54 | 如果不存在依赖,按照main包中import的顺序来调用对应包中init()函数 55 | 如果存在依赖,最后被依赖的最先被初始化 56 | 导入顺序:main-->A-->B-->C 57 | 执行顺序:C-->B-->A-->main 58 | 59 | 5.存在依赖的包之间,不能循环导入 60 | 6.一个包可以被其他多个包import,但是只能被初始化一次。 61 | 7._操作,其实是引入该包,而不直接使用包里面的函数,仅仅是调用了该包里的init() 62 | */ 63 | //utils.Count() 64 | 65 | //pk1.MyTest1() 66 | 67 | //database/sql 68 | 69 | //db,err :=sql.Open("mysql","root:hanru1314@tcp(127.0.0.1:3306)/my1802?charset=utf8") 70 | //if err != nil{ 71 | // fmt.Println("错误信息:",err) 72 | // return 73 | //} 74 | //fmt.Println("链接成功:",db) 75 | 76 | pk2.MyTest3() 77 | } 78 | -------------------------------------------------------------------------------- /l_package/person/person.go: -------------------------------------------------------------------------------- 1 | package person 2 | 3 | type Person struct { 4 | Name string 5 | age int 6 | Sex string 7 | } 8 | -------------------------------------------------------------------------------- /l_package/pk1/test2.go: -------------------------------------------------------------------------------- 1 | package pk1 2 | 3 | import ( 4 | 5 | "fmt" 6 | 7 | ) 8 | 9 | func MyTest1(){ 10 | //utils.Count() 11 | //timeutils.PrintTime() 12 | fmt.Println("pk1包下的MyTest1()函数。。。。") 13 | } 14 | 15 | func init(){ 16 | fmt.Println("pk1包下的init()函数。。。") 17 | } -------------------------------------------------------------------------------- /l_package/pk2/test3.go: -------------------------------------------------------------------------------- 1 | package pk2 2 | 3 | import "fmt" 4 | 5 | func MyTest3(){ 6 | fmt.Println("pk2包下的MyTest3()函数。。。") 7 | } 8 | -------------------------------------------------------------------------------- /l_package/timedemo.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "time" 5 | "fmt" 6 | "math/rand" 7 | ) 8 | 9 | func main() { 10 | /* 11 | time包: 12 | 1年=365天,day 13 | 1天=24小时,hour 14 | 1小时=60分钟,minute 15 | 1分钟=60秒,second 16 | 1秒钟=1000毫秒,millisecond 17 | 1毫秒=1000微秒,microsecond-->μs 18 | 1微秒=1000纳秒,nanosecond-->ns 19 | 1纳秒=1000皮秒,picosecond-->ps 20 | */ 21 | 22 | //1.获取当前的时间 23 | t1 := time.Now() 24 | fmt.Printf("%T\n",t1) 25 | fmt.Println(t1) //2019-06-26 10:46:40.349196 +0800 CST m=+0.000495846 26 | 27 | //2.获取指定的时间 28 | t2 := time.Date(2008,7,15,16,30,28,0,time.Local) 29 | fmt.Println(t2) //2008-07-15 16:30:28 +0800 CST 30 | 31 | //3.time-->string之间的转换 32 | /* 33 | t1.Format("格式模板")-->string 34 | 模板的日期必须是固定:06-1-2-3-4-5 35 | */ 36 | s1 := t1.Format("2006-1-2 15:04:05") 37 | fmt.Println(s1) 38 | 39 | s2 := t1.Format("2006/01/02") 40 | fmt.Println(s2) 41 | 42 | //string-->time 43 | /* 44 | time.Parse("模板",str)-->time,err 45 | */ 46 | s3 := "1999年10月10日"//string 47 | t3 ,err := time.Parse("2006年01月02日",s3) 48 | if err != nil{ 49 | fmt.Println("err:",err) 50 | } 51 | fmt.Println(t3) 52 | fmt.Printf("%T\n",t3) 53 | 54 | fmt.Println(t1.String()) 55 | 56 | //4.根据当前时间,获取指定的内容 57 | year,month,day := t1.Date() //年,月,日 58 | fmt.Println(year,month,day) 59 | 60 | hour,min,sec := t1.Clock() 61 | fmt.Println(hour,min,sec) //时,分,秒 62 | 63 | year2 := t1.Year() 64 | fmt.Println("年:",year2) 65 | fmt.Println(t1.YearDay()) 66 | 67 | month2 := t1.Month() 68 | fmt.Println("月:",month2) 69 | fmt.Println("日:",t1.Day()) 70 | fmt.Println("时:",t1.Hour()) 71 | fmt.Println("分钟:",t1.Minute()) 72 | fmt.Println("秒:",t1.Second()) 73 | fmt.Println("纳秒:",t1.Nanosecond()) 74 | 75 | fmt.Println(t1.Weekday()) //Wednesday 76 | 77 | //5.时间戳:指定的日期,距离1970年1月1日0点0时0分0秒的时间差值:秒,纳秒 78 | 79 | t4 := time.Date(1970,1,1,1,0,0,0,time.UTC) 80 | timeStamp1:=t4.Unix() //秒的差值 81 | fmt.Println(timeStamp1) 82 | timeStamp2 := t1.Unix() 83 | fmt.Println(timeStamp2) 84 | 85 | timeStamp3 := t4.UnixNano() 86 | fmt.Println(timeStamp3) //3600 000 000 000 87 | timeStamp4 := t1.UnixNano() 88 | fmt.Println(timeStamp4) 89 | 90 | //6.时间间隔 91 | t5 := t1.Add(time.Minute) 92 | fmt.Println(t1) 93 | fmt.Println(t5) 94 | fmt.Println(t1.Add(24 * time.Hour)) 95 | 96 | t6 := t1.AddDate(1,0,0) 97 | fmt.Println(t6) 98 | 99 | d1 := t5.Sub(t1) 100 | fmt.Println(d1) 101 | 102 | //7.睡眠 103 | time.Sleep(3 *time.Second) //让当前的程序进入睡眠状态 104 | fmt.Println("main。。。over。。。。。") 105 | 106 | //睡眠[1-10]的随机秒数 107 | rand.Seed(time.Now().UnixNano()) 108 | randNum := rand.Intn(10) + 1 //int 109 | fmt.Println(randNum) 110 | time.Sleep(time.Duration(randNum)*time.Second) 111 | fmt.Println("睡醒了。。") 112 | } 113 | -------------------------------------------------------------------------------- /l_package/utils/timeutils/timeutil.go: -------------------------------------------------------------------------------- 1 | package timeutils 2 | 3 | import ( 4 | "fmt" 5 | "time" 6 | ) 7 | 8 | func PrintTime(){ 9 | fmt.Println(time.Now()) 10 | } -------------------------------------------------------------------------------- /l_package/utils/util.go: -------------------------------------------------------------------------------- 1 | package utils 2 | 3 | import "fmt" 4 | 5 | func Count(){ 6 | fmt.Println("utils包下的Count()函数。。。") 7 | } 8 | 9 | func init(){ 10 | fmt.Println("utils包的另一个init()函数。。") 11 | } 12 | 13 | 14 | func init(){ 15 | fmt.Println("utils包的init()函数,用于初始化一些信息。。。") 16 | } 17 | 18 | -------------------------------------------------------------------------------- /l_package/utils/ytest1.go: -------------------------------------------------------------------------------- 1 | package utils 2 | 3 | import "fmt" 4 | 5 | func MyTest2(){ 6 | Count() 7 | } 8 | 9 | func init(){ 10 | fmt.Println("utils包下的test1.go文件中的init()函数。。。") 11 | } --------------------------------------------------------------------------------