title: Go Web Service - Undefined type has no field or method
body: <p>I am trying to consolidate routing functionality within a web service. The package main has two files of concern, <code>route.go</code> and <code>main.go</code>.</p>
  
  <p>Within <code>route.go</code> I am defining routing as follows:</p>
  
  <pre><code>package main
  
  import (
      "github.com/justinas/alice"
      "net/http"
  )
  
  func (app *Application) Routes() http.Handler {
      standardMiddleware := alice.New(app.logRequest)
  
      mux := http.NewServeMux()
      mux.HandleFunc("/ping", helpers.Ping)
  
      return standardMiddleware.Then(mux)
  }
  </code></pre>
  
  <p>Within <code>main.go</code> I am trying to execute the application as follows:</p>
  
  <pre><code>package main
  
  import (
      "flag"
      "log"
      "net/http"
      "os"
  )
  
  type Application struct {
      errorLog *log.Logger
  }
  
  func main() {
      addr := flag.String("addr", ":8080", "HTTP Network Address")
      flag.Parse()
  
      errorLog := log.New(os.Stderr, "ERROR\t", log.Ldate|log.Ltime|log.Lshortfile)
  
      app := &amp;Application{
          errorLog: errorLog,
      }
  
      srv := &amp;http.Server{
          Addr:     *addr,
          ErrorLog: errorLog,
          Handler:  app.Routes(),
      }
  
      err := srv.ListenAndServe()
      errorLog.Fatal(err)
  }
  
  </code></pre>
  
  <p>When I execute the program I get the following error: <code>app.Routes undefined (type *Application has no field or method Routes)</code></p>
  
  <p>I'm not sure why the method isn't registering correctly?</p>