当前位置:网站首页>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目录下的包,就是这样的:
边栏推荐
- PHP converts two-dimensional array elements into key value pairs
- Use strictmode strictmode principle (1)
- [无线通信基础-15]:图解移动通信技术与应用发展-3- 数字通信2G GSM、CDMA、3G WDCMA/CDMA200/TD-SCDMA、4G LTE、5G NR概述
- 【Content-Type请求头的内容】
- 面对产业互联网的时候,甚至还用消费互联网的方式和方法去落地和实践产业互联网
- Composants de la grille de données portatifs
- org. redisson. client. Redisresponsetimeoutexception: redis server response timeout (3000 ms) error resolution
- 【队列】933. Number of Recent Calls
- Upstream and downstream in software development
- After working for 6 years, let's take stock of the golden rule of the workplace where workers mix up
猜你喜欢
Working for eight years as a programmer, but with a salary of three years after graduation, it's too late to be enlightened again
1500w播放下还藏着什么热点?B站2个未来趋势你不得错过
AS400 API 从零到一的整个历程
图灵奖得主LeCun指明AI未来的出路在于自主学习,这家公司已踏上征途
gin_ gorm
医疗HIS行业短信发送解决方案
[无线通信基础-15]:图解移动通信技术与应用发展-3- 数字通信2G GSM、CDMA、3G WDCMA/CDMA200/TD-SCDMA、4G LTE、5G NR概述
Test essential tool - postman practical tutorial
Ks009 implementation of pet management system based on SSH
7-2 拼题A打卡奖励 dp
随机推荐
Sun Yuchen told Swiss media Bilan that the bear market will not last long
工作八年的程序员,却拿着毕业三年的工资,再不开窍就真晚了...
Open3d point cloud color rendering
短信在企业中的应用有哪些?
Strictmode analysis registration strictmode principle (4)
工作6年,来盘点一下职场人混迹职场的黄金法则
PHP crawls data through third-party plug-ins
Some essential differences
laravel Carbon 时间处理类使用
What will Web3 bring in the future?
Composants de la grille de données portatifs
Handsontable data grid component
Log4j2 threadcontext log link tracking
TypeError: can‘t convert cuda:0 device type tensor to numpy. Use Tensor. cpu() to copy the tensor to
gin_gorm
[simulation] 922 Sort Array By Parity II
小程序中实现excel数据的批量导入
electron之坑addon
Laravel+redis generates an order number - automatically increase from 1 on the same day
System settings large page