Advertisement
Guest User

Untitled

a guest
Jul 10th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.44 KB | None | 0 0
  1. --- File pkg1/a.go
  2. type A struct {
  3.     b B
  4. }
  5.  
  6. func (a A) YouWanted() string{
  7.     return a.b.ProcessString()
  8. }
  9.  
  10. --- File pkg1/b.go
  11.  
  12. type B struct {
  13.     s string
  14. }
  15.  
  16. type (b B) ProcessString() string {
  17.     return strings.TrimPrefix(b.s, "aaaaa")
  18. }
  19.  
  20.  
  21. --- File pkg2/jonsnow.go
  22.  
  23. func JonSnow(something A) string {
  24.     myString := a.YouWanted()
  25.     // JonSnow knows nothing and expect to have a particoular string from this
  26.  
  27.     //...
  28.     return ""
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement