当前位置:网站首页>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目录下的包,就是这样的:

边栏推荐
- AS400 大厂面试
- QT web development - VIDEO - Notes
- mysql插入\更新前+判断条件
- 关于白盒测试,这些技巧你得游刃有余~
- 数据探索电商平台用户行为流失分析
- org.redisson.client.RedisResponseTimeoutException: Redis server response timeout (3000 ms)错误解决
- TypeError: Argument ‘angle‘ can not be treated as a double
- 【栈】921. Minimum Add to Make Parentheses Valid
- Compile and install oh my Zsh
- Creating ASCII art with C #
猜你喜欢
![[fundamentals of wireless communication-14]: illustrated mobile communication technology and application development-2-the first generation mobile analog communication big brother](/img/fa/f9bad44147ba9af21183b7bd630e32.png)
[fundamentals of wireless communication-14]: illustrated mobile communication technology and application development-2-the first generation mobile analog communication big brother

数据探索电商平台用户行为流失分析

Log logrus third party library usage

图灵奖得主LeCun指明AI未来的出路在于自主学习,这家公司已踏上征途

Using recyclerreview to show banner is very simple

neo4j安装、运行以及项目的构建和功能实现

短信在企业中的应用有哪些?

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

gin 配置文件

农产品换房?“变相”购房补贴!
随机推荐
Log4j2 ThreadContext日志链路追踪
With regard to the white box test, you have to master these skills~
测试必备工具-Postman实战教程
数学知识:求组合数 IV—求组合数
Strictmode jamming and leakage detection -strictmode principle (2)
面对产业互联网的时候,甚至还用消费互联网的方式和方法去落地和实践产业互联网
org. redisson. client. Redisresponsetimeoutexception: redis server response timeout (3000 ms) error resolution
【agora】用户管理
[content of content type request header]
Draw some interesting figures with flutter's canvas
微生物安全與健康,什麼是生物處理?
图灵奖得主LeCun指明AI未来的出路在于自主学习,这家公司已踏上征途
微生物检测,土壤微生物的作用有哪些?
使用 C# 创造 ASCII 艺术
Using recyclerreview to show banner is very simple
laravel 事件 & 监听
Zero of DC learning notes -- overview and basic process introduction
微研所,微生物检验中常用的生化反应
What will Web3 bring in the future?
小程序云开发之--微信公众号文章采集篇