首页 > 解决方案 > Calling methods defined in different parts of the directory to wherever you want

问题描述

标签: oopgointerface

解决方案


I could see a few unexported items in your code sample. Try exporting them first and build..

Export subSvc:

package collegeutil

type CollegeUtil struct {
   SubSvc college.subjectService
}

Eport subjectService:

package college

type SubjectService interface {
   AddCourse(ctx context.Context, param1 string, param2 string)
}

And:

reply, err := college.SubjectService.AddCourse(ctx, param1 string, param2 string)

This is not a solution; since I don't have rough reputation to comment, adding here.


推荐阅读