We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
既有的导出包如果已经存在,里面可能有部分代码是手工改动后的,直接覆盖不是很合适。建议:
如果已经存在目标的包,则找到目标包的 Exports 表,如果里面已经存在某个函数就不必再导出。例如假设我们要导出一个名为 foo 的包,但是这个目标包已经存在,内容如下:
package foo ... // Exports is the export table of this module. // var Exports = map[string]interface{}{ "bar": newBar, ... }
比较适合的执行流程是:
另外还有一个需要注意的细节是:有些 Exports 函数由于是特定版本增加的,它未必出现在 Exports 表中,而是通过 func init() 函数添加。例如:
// +build go1.6 package runtime import "runtime" func init() { Exports["readTrace"] = runtime.ReadTrace Exports["startTrace"] = runtime.StartTrace Exports["stopTrace"] = runtime.StopTrace }
对于这样的函数,也没有必要在 Exports 表中重复添加。
The text was updated successfully, but these errors were encountered:
#112 支持特定版本导出
Sorry, something went wrong.
#137 支持包合并功能
visualfc
No branches or pull requests
既有的导出包如果已经存在,里面可能有部分代码是手工改动后的,直接覆盖不是很合适。建议:
如果已经存在目标的包,则找到目标包的 Exports 表,如果里面已经存在某个函数就不必再导出。例如假设我们要导出一个名为 foo 的包,但是这个目标包已经存在,内容如下:
比较适合的执行流程是:
另外还有一个需要注意的细节是:有些 Exports 函数由于是特定版本增加的,它未必出现在 Exports 表中,而是通过 func init() 函数添加。例如:
对于这样的函数,也没有必要在 Exports 表中重复添加。
The text was updated successfully, but these errors were encountered: