我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

有没有办法覆盖golang包?

I have import statements in my code that look like this:

import "github.com/A/package"

It turns out that - temporarily - I need to use github.com/B/package.

Rather than modify the source, and re-modify it later, is there a way to specify an override?

Since Go1.11, modules allow the use of the replace directive in the go.mod file of the project. It allows to override an expressed dependency by another module.

Online reference is https://github.com/golang/go/wiki/Modules#when-should-i-use-the-replace-directive

近期文章

  • 如何在golang中将源IP地址udp包更改为伪IP?
  • Golang将AST表示为结构并将其序列化
  • 嵌入相互依赖的结构/接口
  • 有没有办法在模型中使用gobuffalo i18n转换器?
  • go-mssql设置连接超时
  • Gocui在寻呼机程序后中断
  • 搜索Golang翻译
  • 在Go中解析JSON Web令牌声明
  • 如何轮询GitHub存储库以进行更改
  • 转到基本的exec命令,该命令的打印输出有问题
  • 无法从Mongo记录[mgo]:golang在结构接口上仅向上插入一个值
  • 在golang中实现io.ReadWriteSeeker
  • 将Singleton数据库类与单独的模型和服务包一起使用
  • 数据更改时自动更新PostgreSQL
  • 与RPC的双向通讯
  • 通过给go命令install-unexpected目录布局错误
  • AWS CodeBuild无法“获取”软件包
  • 基于map接口数组中键的golang过滤器
  • 致电Time.In时缺少位置
  • mongodb update添加每个地图结构的值

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华