当前位置:网站首页>go导入自建包
go导入自建包
2022-07-01 01:10:00 【qq_45691577】
1.go mod init 你的mudlename
(在项目文件夹之下执行命令)
比如我这里的包名是wjj/ginessetial
2.创建自己的包,并在main.go中引入
新建一个文件夹,比如这里是DB

DB中创建的go文件包的名称为db

那么当你在main.go中向要调用DB文件夹下的某个函数(如此处为Initdb),该怎么引入对应的包呢?
在main.go中,引入的时候要这么写:
import "你的modulename/项目根目录/函数所在文件夹"
例如我要引入DB目录下的包,就是这样的:

边栏推荐
- Log logrus third party library usage
- For the sustainable development of software testing, we must learn to knock code?
- 7-2 拼题A打卡奖励 dp
- Sun Yuchen told Swiss media Bilan that the bear market will not last long
- [problem handled] -nvidia SMI command cannot obtain the GPU process number of its own container and the external GPU process number
- Strictmode jamming and leakage detection -strictmode principle (2)
- [Office PDF] PDF merging and splitting will free us from the functional limitations of paid software, OK
- Last day of the second quarter
- 面对产业互联网的时候,甚至还用消费互联网的方式和方法去落地和实践产业互联网
- laravel Carbon 时间处理类使用
猜你喜欢

Lecun, a Turing Award winner, pointed out that the future of AI lies in self-learning, and the company has embarked on the journey

那些一门心思研究自动化测试的人,后来怎样了?

Basic knowledge II - Basic definitions related to sta

迪赛智慧数——其他图表(平行坐标图):2021年应届专业就业情况

小程序中实现excel数据的批量导入

For the sustainable development of software testing, we must learn to knock code?

微研所,微生物检验中常用的生化反应

Compile and install oh my Zsh
![[Qt5 basics] random number display](/img/1f/a3d310788dbc45c71d3b5c47d50a5b.png)
[Qt5 basics] random number display

一站式洞察行业热点,飞瓜数据B站新功能「流量大盘」上线!
随机推荐
What will Web3 bring in the future?
Strictmode jamming and leakage detection -strictmode principle (2)
[deepin] common sets
工作6年,来盘点一下职场人混迹职场的黄金法则
Use of laravel carbon time processing class
短视频平台开发,依靠DrawerLayout实现侧滑菜单效果
Use strictmode strictmode principle (1)
Matlab farthest point sampling (FPS improved version)
短信在企业中的应用有哪些?
[content of content type request header]
Complete software development process
Some items of OCR
TypeError: Argument ‘angle‘ can not be treated as a double
远程办公如何保持高效协同,实现项目稳定增长 |社区征文
工作八年的程序员,却拿着毕业三年的工资,再不开窍就真晚了...
PHP数组拼接MySQL的in语句
45 year old programmer tells you: why do programmers want to change jobs? It's too true
Log4j2 ThreadContext日志链路追踪
org.redisson.client.RedisResponseTimeoutException: Redis server response timeout (3000 ms)错误解决
微生物检测,土壤微生物的作用有哪些?