当前位置:网站首页>Golang language quickly get started to comprehensive practical notes (go language, beego framework, high concurrency chat room, crawler)
Golang language quickly get started to comprehensive practical notes (go language, beego framework, high concurrency chat room, crawler)
2022-07-25 20:41:00 【Full stack programmer webmaster】
Hello everyone , I meet you again , I'm the king of the whole stack .
1.go get The essence is : Code management tools (git) + go install
2.struct
go There is no language private,public,protected Such keywords To make a symbol for another package package so ( You can visit ), You need to define the symbol to start with an uppercase letter
package main
import "fmt"
type Person struct {
name string
age int
}
type Student struct {
Person // Anonymous field , Default includes person All fields in
sex string
}
func main() {
//person:=Person{"zhangsan",25} //{zhangsan 25}
//person := Person{age: 22, name: "lxw"}
//stu1 := Student{Person{name: "test", age: 11}, " male "}
stu1 := Student{Person{"test", 113}, " male "}
//fmt.Printf("%v", person)
fmt.Printf("%v", stu1.Person.age)//113
fmt.Printf("%v", stu1.name)//test
fmt.Printf("%v", stu1.age)//113
fmt.Printf("%v", stu1.sex)// male
}3. object-oriented
3、 ... and . common problem
go: cannot use [email protected] syntax in GOPATH mode Problem solving
problem : perform go get github.com/golang/protobuf/[email protected] Times wrong
go get github.com/golang/protobuf/[email protected]
go: cannot use [email protected] syntax in GOPATH modesolve : Need to open GO111MODULE, The default is auto, open .zshrc,( Be careful : Check which one you are currently using shell, yes bash It is necessary .bash_profile Editor in chief ) add to export GO111MODULE=on that will do . After the revision, remember source
export GO111MODULE=onsource
source ~/.zshrcreason :
go mod Can pass GO111MODULE To control whether to enable ,GO111MODULE There are three types . on All the builds , All use Module Mechanism off All the builds , Not used Module Mechanism , But use GOPATH and Vendor auto stay GOPATH The next project , Don't use Module Mechanism , be not in GOPATH Project use under
Video address :https://www.bilibili.com/video/av71154002/
Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/111541.html Link to the original text :https://javaforall.cn
边栏推荐
- Vulnhub | dc: 6 | [actual combat]
- Leetcode-6130: designing digital container systems
- Compilation and operation of program
- [MCU] 51 MCU burning those things
- Character function and string function (2)
- Step num problem
- [today in history] June 28: musk was born; Microsoft launched office 365; The inventor of Chua's circuit was born
- 第六章 修改规范(SPEC)类
- The database empties the table data and makes the primary key start from 1
- Use of C log4net: add file name and line number to the output log content; Repackaged class output file name and line number
猜你喜欢

【TensorRT】动态batch进行推理

JMeter - interface test

FanoutExchange交换机代码教程

Network protocol: TCP part2

leetcode-79:单词搜索

Solution to oom exceptions caused by improper use of multithreading in production environment (supreme Collection Edition)
![[tensorrt] dynamic batch reasoning](/img/59/42ed0074de7162887bfe2c81891e20.png)
[tensorrt] dynamic batch reasoning

雷达水位计的工作原理及安装维护注意事项

leetcode-6130:设计数字容器系统
![[today in history] July 4: the first e-book came out; The inventor of magnetic stripe card was born; Palm computer pioneer was born](/img/0b/73f0d98a6db813e54074abe199ed98.png)
[today in history] July 4: the first e-book came out; The inventor of magnetic stripe card was born; Palm computer pioneer was born
随机推荐
Leetcode-6126: designing a food scoring system
Go language go language built-in container
2022.7.24-----leetcode.1184
[leetcode] 28. Implement strstr ()
Leetcode-155: minimum stack
Hello, I'd like to ask questions about C and database operation.
Use Navicat to connect to MySQL database through SSH channel (pro test is feasible)
leetcode-114:二叉树展开为链表
使用oap切面导致controller被重复调用
增加 swap 空间
Remote - actual combat
Vulnhub | dc: 5 | [actual combat]
ROS_ Rqt toolbox
Learn FPGA from the bottom structure (16) -- customization and testing of pll/mmcm IP
Basic knowledge of Marine Geology
Docker 搭建 Redis Cluster集群
【单细胞高级绘图】07.KEGG富集结果展示
Force deduction ----- calculate the money of the force deduction bank
MySQL date [plus sign / +] condition filtering problem
Leetcode-146: LRU cache