Adding method to a golang struct in a different file

Viewed 14214

How would one go about adding a method to a struct that is a different file? This is what I've tried so far but it doesn't seem to be working.

// ./src
package routes

type App struct{

}

func (a *App) initializeRoutes() {
  a.Subrouter.HandleFunc("/products", a.getSomething).Methods("GET")
}

// ./src/controller
package routes

func (a *App) getSomething(w http.ResponseWriter, r *http.Request){

...

}
2 Answers
Related