我在包notifications
/notifications
/html/notify.tpl
问题是,如果我从不同的路径/包中调用此包的函数,它将无法再找到该文件,因为程序假定该路径属于正在调用的包。 例如
ls
main.go
/notifications
/html/notify.template
去运行main.go
open html/notify.tpl: no such file or directory
答案 0 :(得分:1)
你没有。
您可以提供配置路径,使用众所周知的完全限定路径,使用相对于工作目录的路径(不推荐),或者三者的组合。