当前位置:网站首页>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
边栏推荐
- How to use buffer queue to realize high concurrent order business (glory Collection Edition)
- Introduction to several scenarios involving programming operation of Excel in SAP implementation project
- C language file reading and writing
- 文件操作详解
- [leetcode] 28. Implement strstr ()
- MPI学习笔记(二):矩阵相乘的两种实现方法
- test
- Network protocol: TCP part2
- Use of C log4net: add file name and line number to the output log content; Repackaged class output file name and line number
- Implementation of simple registration and login
猜你喜欢

程序的编译和运行
[today in history] June 30: von Neumann published the first draft; The semiconductor war in the late 1990s; CBS acquires CNET

Docker builds redis cluster

Working principle of radar water level gauge and precautions for installation and maintenance

智能电子界桩自然保护区远程监控解决方案

How to choose a microservice registration center?

Today's sleep quality record 75 points
![[today in history] July 8: PostgreSQL release; SUSE acquires the largest service provider of k8s; Activision Blizzard merger](/img/14/f2b68dbe4e6a9b8d89ed9ff38f5e11.png)
[today in history] July 8: PostgreSQL release; SUSE acquires the largest service provider of k8s; Activision Blizzard merger

preprocessor directives

Leetcode-79: word search
随机推荐
Why did I choose to become a network engineer after graduating from weak current for 3 months
智能电子界桩自然保护区远程监控解决方案
Key network protocols in tcp/ip four layer model
leetcode-6126:设计食物评分系统
增加 swap 空间
【ONNX】pytorch模型导出成ONNX格式:支持多参数与动态输入
Online XML to JSON tool
Kubernetes advanced part learning notes
Leetcode-6127: number of high-quality pairs
leetcode-6125:相等行列对
Use Navicat to connect to MySQL database through SSH channel (pro test is feasible)
How to realize reliable transmission with UDP?
毕业从事弱电3个月,我为什么会选择转行网络工程师
Use of C log4net: add file name and line number to the output log content; Repackaged class output file name and line number
【单细胞高级绘图】07.KEGG富集结果展示
preprocessor directives
Leetcode-919: complete binary tree inserter
test
[advanced drawing of single cell] 07. Display of KEGG enrichment results
Character function and string function (2)