当前位置:网站首页>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
边栏推荐
- Introduction to MySQL engine and InnoDB logical storage structure
- 第六章 修改规范(SPEC)类
- Leetcode-6131: the shortest dice sequence impossible to get
- [today in history] June 28: musk was born; Microsoft launched office 365; The inventor of Chua's circuit was born
- Leetcode-155: minimum stack
- [workplace rules] it workplace rules | poor performance
- process.env
- [tensorrt] trtexec tool to engine
- Volcanic engine Xiang Liang: machine learning and intelligent recommendation platform multi cloud deployment solution officially released
- Automated testing ----- selenium (I)
猜你喜欢

FanoutExchange交换机代码教程

Struct, enum type and union

Leetcode-6127: number of high-quality pairs

预处理指令

毕业从事弱电3个月,我为什么会选择转行网络工程师
![[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

Has baozi ever played in the multi merchant system?
![[noi simulation] string matching (suffix automata Sam, Mo team, block)](/img/db/3ccb00e78bba293acdae91ffa72a2c.png)
[noi simulation] string matching (suffix automata Sam, Mo team, block)

leetcode-6127:优质数对的数目
![Vulnhub | dc: 5 | [actual combat]](/img/c6/34117bbfb83ebdf9e619f4e4590661.png)
Vulnhub | dc: 5 | [actual combat]
随机推荐
Has baozi ever played in the multi merchant system?
Vulnhub | dc: 6 | [actual combat]
leetcode-6125:相等行列对
Card link
Remote—实战
Cloud native, Intel arch and cloud native secret computing three sig online sharing! See you today | issues 32-34
Wokerman custom write log file
Online XML to JSON tool
[today in history] July 3: ergonomic standards act; The birth of pioneers in the field of consumer electronics; Ubisoft releases uplay
Leetcode-146: LRU cache
移动web布局方法
Remote—基本原理介绍
Principle analysis of bootloader
Leetcode-919: complete binary tree inserter
JS scope and scope chain
[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
C language file reading and writing
Use of C log4net: add file name and line number to the output log content; Repackaged class output file name and line number
[today in history] July 13: the father of database passed away; Apple buys cups code; IBM chip Alliance