草庐IT

go - 如何从不同的包中调用包

我正在尝试从ModelT包中获取一个函数到我的Controllers包中。我看过CallafunctionfromanotherpackageinGo上的例子但是它不起作用。这是我的简单代码packageModelT--Print.gofuncPrintMe()string{return"hello"}packageControllers--Circle.goimport("Yislyapp/ModelT")--ThisdoesnotworkfuncCircle_List(){ModelT.PrintMe()}我的小程序不会编译说:cannotresolvedirectoryyisly

go - 如何从不同的包中调用包

我正在尝试从ModelT包中获取一个函数到我的Controllers包中。我看过CallafunctionfromanotherpackageinGo上的例子但是它不起作用。这是我的简单代码packageModelT--Print.gofuncPrintMe()string{return"hello"}packageControllers--Circle.goimport("Yislyapp/ModelT")--ThisdoesnotworkfuncCircle_List(){ModelT.PrintMe()}我的小程序不会编译说:cannotresolvedirectoryyisly