i have a package named as “pkg” in which there is a method PrintInfo which has a receiver of Type A struct i want to call this method in main package but in main package i can’t call it
I want to know how can i call PrintInfo method ?
package pkg
type A struct{
Name string
Age int
}
func (a *A)PrintInfo(){
fmt.Println("Name: “,a.Name,” Age: ",a.age)
}
package main
import “github.com/taalhach/GolangRepo/pkg”
var a = pkg.A{
Name:“Talha”,
Age:22,
}
func main(){
// how can i call method here now ?
pkg.PrintInfo() is unavailable
}